Tag Info

Hot answers tagged

12

Switching the color is done through escape sequences embedded in the text. Invariably, programs issue ANSI escape sequences, because that's what virtually all terminals support nowadays. The escape sequence to switch the foreground color to red is \e[31m, where \e designates an escape character (octal 033, hexadecimal 1b, also known as ESC, ^[ and various ...


8

awk -F '","' 'BEGIN {OFS=","} { if (toupper($5) == "STRING 1") print }' file1.csv > file2.csv Output "12310","42324564756","a simple string with a , comma","string with or, without commas","string 1","USD","12","70%","08/01/2013","" "23525","74535243123","string , with commas, and - hypens and: semicolans","string with or, without commas","string ...


6

You can have grep look for control characters, some of which are responsible for making the pretty colors on the terminal. dolongtask | grep '[[:cntrl:]]' For example, this echoes a red "test" into grep, which finds it due to it being surrounded by control characters: $ echo -e '\033[00;31mtest\033[00m' | grep --color=none '[[:cntrl:]]' test <-- ...


3

awk '$3 >= "11:58" && $3 <= "23:58" && /Unit ID: 1111/{print l"\n"$0};{l=$0}'


3

Pravin offers some good general points, but doesn't really elaborate on any of them and doesn't address your likely actual problems. First, you need to find out how postfix is receiving those messages and why it's choosing to relay them (the two questions are very likely related). The best way to do it is by looking at the message ID of any one of the ...


3

You can use a regular expression: &!cat|dog|fish


2

Just type: *myfile* You can also do: "$(ls | grep pattern)" if you full regular expression matching rather than just filename wildcards. All these solutions assume there's just a single file in the current directory that matches the pattern.


1

You can use xargs for this sort of thing: ls | grep myfile | xargs sh xargs reads lines on its input and gives them as arguments to the program it's given as argument: here, it will read the output of grep and then run sh long_myfile_name. (Change sh to bash if your script depends on Bash-specific features, or some other shell) You can also run sh ...


1

Old post, but for reference, it wouldn't work for a few reasons: The priority should be 16 and not 1 The filter handle should be 800::800 and not 800:800 You must supply the parent qdisc that the filter is attached to This should work: tc filter del dev peth1 parent 1: handle 800::800 prio 16 protocol ip u32


1

The filter settings are saved as a gsettings scheme: org.gnome.gnome-system-log.filters. You can edit them with dconf-editor (org>gnome>gnome-system-log>filters). Replace the space in the name of the filter with a dash (or some other character), and gnome-system-log will work again.


1

In practice I found the following idiom enough: ps auxf | grep -v ]$ It filters lines ending with brackets, which might result omitting unwanted entries but it's very unlikely. In exchange it's quite easy to remember and relatively quick to type.


1

You can simply use | less -r >


1

This sed command did it for me: sed -r "s/\\^\\[(\\[[^@-~]+[@-~]|[0-9@-_]|%@)//g" Example: $ command-that-produces-colored-output | sed -r "s/\\^\\[(\\[[^@-~]+[@-~]|[0-9@-_]|%@)//g" > outfile



Only top voted, non community-wiki answers of a minimum length are eligible