The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 03-22-2007
prkfriryce prkfriryce is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 44
I'm gonna use sed for the time being, but would like to know the correct awk syntax as well

cat abc | sed 's/\(.*\)xyz://' | awk -F: '{print $1,NF}'

edit*

Quote:
Originally Posted by anbu23
Code:
awk -F: -v OFS="\nor\n" ' { sub(".*xyz:",""); for(i=1;i<=NF;++i) $i=$i" "NF ;print }  ' file
thanks, i'll try it