Friday, July 16, 2021

AWK - Get the last 9th field only using awk

 $ cat hist.txt

1234   Mon  12 Apr  2021  01:23:10 PM EDT cd /opt/data/
1235   Mon  12 Apr  2021  01:23:10 PM EDT ls
1236   Mon  12 Apr  2021  01:23:10 PM EDT scp *.cfg jay@lx206:/tmp/config

$ cat hist.txt | awk '{$1=$2=$3=$4=$5=$6=$7=$8=" "; print "$" $0;} | more}'
$ cd /opt/data/
$ ls
$ scp *.cfg jay@lx206:/tmp/config

No comments:

Post a Comment

Git branch show detached HEAD

  Git branch show detached HEAD 1. List your branch $ git branch * (HEAD detached at f219e03)   00 2. Run re-set hard $ git reset --hard 3. ...