Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
get value of 200th field by awk
Name: sivakarthik Date: October 6, 2005 at 09:47:28 Pacific OS: Unix CPU/Ram: 512MB
Comment:
Hi, I'm not able to get the value of 200th field using awk. Can you please help me
Thanks Siva
Hi, I'm trying to replace a column in a comma seperated file with a column in another file using sed/awk. Can anyone help me.
Name: sivakarthik Date: October 6, 2005 at 10:21:32 Pacific
Reply:
awk -F['|'] '{print $200}' GMS.txt gave the following error
awk: The field 200 must be in the range 0 to 199.
please help.
Thanks Siva
Hi, I'm trying to replace a column in a comma seperated file with a column in another file using sed/awk. Can anyone help me.
Thanks Siva
0
Response Number 2
Name: Jim Boothe Date: October 6, 2005 at 10:50:09 Pacific
Reply:
I specified a delimiter that I knew would not exist in my file so that awk would see the lines as having only one long field (to prevent the abort). Then I split the lines into my own array and printed the 200th array slot.
awk -F: '{split($0,f," ");print f[200]}' infile
0
Response Number 3
Name: sivakarthik Date: October 7, 2005 at 01:19:42 Pacific
Reply:
Great, that helps. Thanks Jim.
Siva
Hi, I'm trying to replace a column in a comma seperated file with a column in another file using sed/awk. Can anyone help me.
Summary: There are some things here that can stand some clarification and warnings ... The vi and sed solutions above will remove ALL leading spaces on each line. If desired, they could be changed to delete j...
Summary: How to get the return value of a awk in a shell script? awk -F['|'] '{print $6}' file.txt In the above if the column 6 is null the script fails. How can I get the return value to do a check after this...
Summary: Each comma in your print command is causing awk to insert a space at that position. Actually, awk inserts the current value of the Output Field Separator (OFS), which by default is set to a space. So ...