ls -la |grep -i ‘opt’ | awk ‘{print $10}’ > //test.txt |
Example of script that uses awk and includes 9th field and everything else on the line.
#!/bin/sh
[ -f /tmp/errlst ] && rm /tmp/errlst
./bperror | grep -i win32 >/tmp/errlst
while read line; do
A=`echo $line | awk ‘{for (i=9; i<=NF; i++) print $i}’` echo $A done < /tmp/errlst