How to select and edit on a particular column?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to select and edit on a particular column?
# 1  
Old 01-15-2010
How to select and edit on a particular column?

How can I use awk to pick a particular column and work on it? For example, I want to count the number of characters in column10 that are separated by |?

Thank you.
# 2  
Old 01-15-2010
Try:
Code:
awk -F"|" '{print length($10)}' file

# 3  
Old 01-15-2010
thanks for you.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need Help to Edit multiple column of a file

Hello Team, I want to know if there is any one liner command , using which I can edit multiple column of a file. input file input.txt (comma separated), taran, 12.45, uttam, 23.40, babay karan, 12.45, raju, 11.40, rahulg I want to update, 2nd and 4th column, but want all those column... (8 Replies)
Discussion started by: Uttam Maji
8 Replies

2. Shell Programming and Scripting

Edit column using sort

Hi Expert, Please kindly need your help, I dont have any idea how to make this input to be as output. Thanks before $ more input.dat @zmap_fault HEADER , FALT, 80, 1 X (EASTING) , 1, 1, 1, 1, 15, 7, 0.1000000E+31, , 15, 7, 0 Y... (5 Replies)
Discussion started by: ipatah
5 Replies

3. Shell Programming and Scripting

SELECT and wrapping to next column

Hi all, Am trying to write a menu driven script using SELECT and if I have more than 4 options, it wraps to the next column. That is if I have 6 choices, items 5 and 6 are in the second column. Is there any settings that control this behavior or is it due to some stty settings? stty -a... (3 Replies)
Discussion started by: newbie_01
3 Replies

4. Shell Programming and Scripting

To select only column starting with a particular value

Hi all, Am using awk to reformat an existing file cat $INP_FILE1 | while read line do echo "$line" | nawk ' BEGIN {FS=","} {print("5",$1,$28,"$27",$26)}' >> $OUT_FILE1 done my question is, i would like to read lines that are starting with particular value only example ... (9 Replies)
Discussion started by: selvankj
9 Replies

5. Shell Programming and Scripting

Cut column and edit data

Mar 26 12:32:53 name sshd: 192.168.1.14 Mar 27 12:42:53 name sshd: 192.168.1.14 how to make this data in output as: "Mar 26 12:32:53","name","sshd","192.168.1.14" "Mar 27 12:42:53","name","sshd","192.168.1.14" anyone plzz help me out!!!!!!!!!!!!!! (4 Replies)
Discussion started by: jacky29
4 Replies

6. Shell Programming and Scripting

select last column

Hi! From a file the format of whichis as in the sample here below, I need to get two files having just 2 columns, being - for the first file - the 2nd than the 1st from the original file; and - for the second file - the LAST then the 1st column of the original file. Moreover, I would sort the... (3 Replies)
Discussion started by: mjomba
3 Replies

7. Shell Programming and Scripting

Awk or Sed, fubd match in column, then edit column.

FILE A: 9780743551526,(Abridged) 9780743551779,(Unabridged) 9780743582469,(Abridged) 9780743582483,(Unabridged) 9780743563468,(Abridged) 9780743563475,(Unabridged) FILE B: c3saCandyland 9780743518321 "CANDYLAND" "MCBAIN, ED" 2001 c3sbCandyland 9780743518321 ... (7 Replies)
Discussion started by: glev2005
7 Replies

8. Programming

select value from 'value' column if the Value2 is having a particular value.

Two columns are there in a table Value and Value2.I need to select a desired value from 'value' column if the Value2 is having a particular value. Ex. Table has values ---------------------------- Value Value2 ---------------------------- 1 GOD ... (6 Replies)
Discussion started by: gameboy87
6 Replies

9. UNIX for Dummies Questions & Answers

to select according to the second column..!!

the input is : 6298 | anna | chennai | 7/4/08 3981 | dastan | bagh | 8/2/07 6187 | galma | london | 9/5/01 3728 | gonna | kol | 8/2/10 3987 | hogja | mumbai | 8/5/09 2898 | homy | pune | 7/4/09 9167 | tamina | ny | 8/3/10 4617 | vazir | ny now how to get the following output : 3987 |... (4 Replies)
Discussion started by: adityamitra
4 Replies

10. Shell Programming and Scripting

select a column

I've a file like this: andrea andre@lol.com october antonio@lol.com marco 45247@pop.com kk@pop.com may pollo@lol.com mary mary@lol.com can I select only the column with email adress? can I utilise a filter with @ ? I want obtain this: ... (2 Replies)
Discussion started by: alfreale
2 Replies
Login or Register to Ask a Question