linuxawkaliastcsh

awk -F inside an alias command (tcsh)


I'm having some issues with aliasing the following command:

a gl 'cat \!:1 | awk -F'-c ' '{print$2}' | awk -F' ' '{print($1)}'

here's a sample of the text I am trying to parse - the goal is to reach the after -c, the question is how to alias the awk command.

command: cloud-tool -a <path to file> -b <path to file> -c <path to file> -d <path to file> -e <path to file> -f <path to file> param_alpha=on optimizeTriangle=on genericSupport=on forceConfig <path to file> pathConfig=/system/tool/configs/settings.txt SensorConfig: sensorMode=primary --synchronize=on --skipMissing

grateful for any assistance!


Solution

  • This should achieve what you wanted :

    alias gl 'awk -F"-c " '\''{print $2}'\'' \!:1 | awk -F" " '\''{print $1}'\'
    

    The main idea is to put single quotes around awk-scripts.