Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print $4 to end of line?

Status
Not open for further replies.

mikeboz

MIS
May 18, 2000
41
US
I want to print $4 to the end of the line.

sample

32333r#1.mi 32333r#1 r#1 this is a description of the part


output:

this is a description of the part
 
echo "32333r#1.mi 32333r#1 r#1 this is a description of the part" | cut -d' ' -f4-

I had a very similar thread started a couple of hours ago on the related subject. I'd wonder how to do it purely in awk with NO NF/loop involved.

vlad
 
this is not so clean but,

awk '{print $4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14}' file1 > file2

it works, dont know what kind of problems it may cause.
 
this doesn't "cut" it - the poster needed a GENERIC solution - can't hard-wire the number of fields.

vlad
 
Here is one way. Not silver bullet elegant, however!

nawk '{$1=$2=$3="";sub(" ","");print}' infile

Note that assigning the null to the first three fields does
not remove the FS associated with it, thus the sub
function call.

HTH


flogrr
flogr@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top