Place quotation marks in `alias` -` CSH`

I want to have an alias that will execute the command:

zgrep 'failed at' $PWD/RESULTS/log_dir/* | cut -d"'" -f2,4 | tr "'" "\t" 

I tried different ways to put it in an alias, but none of them seem to work. for example, some of my attempts:

 alias get_failed "zgrep 'failed at' $PWD/RESULTS/log_dir/* | cut \"\'\" -f2,4 | tr \"\'\" \"\\t\"" alias get_failed "zgrep 'failed at' $PWD/RESULTS/log_dir/* | cut \"\'\" -f2,4 | tr \"\'\" \"\\t\" 

and others, how can I make my alias?

+4
source share
1 answer

The problem is caused by the csh function: you cannot avoid "if you are already in the" -quoted string "(it is the same for"). This is still the default due to compatibility issues. You can use a simpler shell or use the backslash_quote configuration:

 set backslash_quote alias get_failed "zgrep 'failed at' $PWD/RESULTS/log_dir/* | cut -d\"'\" -f 2,4 | tr \"'\" \"\\t\"" 

Also note that your cut call removes any one quote ('), so your tr call will not do much. (I edited my answer several times to make sure it matches your original command.)

+3
source

All Articles