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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help using awk or sed... 1

Status
Not open for further replies.

nithink

Programmer
Nov 7, 2002
92
0
0
US
Hi,
Help using awk or sed...

I've a text file which contains pipe delimited data like,

100|EQTX|EQUITY TAXABLE|
102|GTHTX|GROWTH TAXABLE|
105|CPRESTX|CAPITAL PRESER TAXABLE - PFM|
103|GINCTX|GROWTH & INCOME TAXABLE|

After using sed or awk, I need an output file which
just contains the first and third column. I want to remove
the 2nd column.

output file should look like,
100|EQUITY TAXABLE|
102|GROWTH TAXABLE|
105|CAPITAL PRESER TAXABLE - PFM|
103|GROWTH & INCOME TAXABLE|

Can you pls help me with this ? thanks much.. NK
 
How about:
awk -F"|": '{ print $1"|"$3"|" }' in.txt > out.txt

Where in.txt is the before file and out.txt is after.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Something like this ?
awk 'BEGIN{FS=OFS="|"}{print $1,$3,""}' /path/to/input

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top