Computing.Net > Forums > Unix > sed help

sed help

Reply to Message Icon

Original Message
Name: Orasparkle
Date: March 25, 2005 at 20:08:10 Pacific
Subject: sed help
OS: XP
CPU/Ram: P4 & 512
Comment:

I have a file with 5k records & each record is of the following format "first name last name DOB". I am having problem removing the DOB(Date ) column which is in the following format (MM/DD/YYYY).

Orasparkle


Report Offensive Message For Removal

Response Number 1
Name: eng_sammer
Date: March 25, 2005 at 20:27:55 Pacific
Subject: sed help
Reply: (edit)

I need your help ... please how can I download the following driver :
S3 396/397 display card


Report Offensive Follow Up For Removal

Response Number 2
Name: wollie
Date: March 26, 2005 at 06:34:48 Pacific
Subject: sed help
Reply: (edit)

Orasparkle,

if you want to eliminate the last column just make use of awk to cut it off

greet$

Wollie


Report Offensive Follow Up For Removal

Response Number 3
Name: nails
Date: March 26, 2005 at 16:58:15 Pacific
Subject: sed help
Reply: (edit)

Wollie is right; use awk to print the fields you want:

awk ' { printf("%s %s\n", $1, $2) } ' myfiles

If you insist on using sed, this works, but I still don't recommend it:

sed 's/ *\([^ ]* *\)$//' myfile

Nails


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: sed help

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software