• Post Reply Bookmark Topic Watch Topic
  • New Topic

Select particular field in file in UNIX, Please help me in  RSS feed

 
ramesh sk
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi javaranchers,
Here i got some problem and i'm not getting the idea what to do with this,
i have a file in that it has records(number of) like below the format with delimiters " | " for each column.
col1|col2|column3-Date Format|col4|col5 |col6
ABCD|ABCD|15/07/2005 09:37:00|INR |india|cash
ABCD|ABCD|30/09/2005 09:37:00|INR |india|cash
just think it is like table having 6 fields, if i select 0ne field then all records of that particular field should be in another file.
i'm new to this UNIX environment. is there any idea to write it in shell script or is there any command to do this,
please help me in this ,
thanks in advance,
ramesh
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the awk program -which is available on all Unix variants- will do what you need. Take a look here for an introduction and here for the man pages.
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well there's awk



If you've read the man pages / some of the docs you will understand what that means

Or you could use cut which is less powerful than awk, but may be more suited for parsing sopmething like this.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!