![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Convert character in word to CAPS?? | vadharah | Shell Programming and Scripting | 3 | 04-01-2008 08:44 AM |
| how to read the column and print the values under that column | gemini106 | Shell Programming and Scripting | 6 | 03-28-2008 07:05 AM |
| Convert Header into Column in Text file | vsubbu1000 | Shell Programming and Scripting | 7 | 08-06-2007 05:09 AM |
| Retrieve line from a file based on a value in specific column | efernandes | UNIX for Dummies Questions & Answers | 1 | 01-27-2007 11:04 AM |
| How to read from a file line by line and do stuff | spaceship | Shell Programming and Scripting | 4 | 03-17-2005 09:47 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
read a line from a csv file and convert a column to all caps
Hello experts,
I am trying to read a line from a csv file that contains '.doc' and print the second column in all caps. e.g. My csv file contains: Test.doc|This is a Test|test1|tes,t2|test-3 Test2.pdf|This is a Second Test| test1|tes,t2|t-est3 while read line do echo "$line" | awk -F '|' '/.doc/ {print toupper($2)}' done < $dataFile output: This is a Test I've been trying to use the toupper function of awk but it does not convert to upper case. Anyone know another way this can be done? thanks |
|
||||
|
Hate to tell you this, but it worked for me on an AIX box. I cut and paste your code as is.
Perhaps, if you are on Solaris, try nawk instead. Wouldn't it be simpler to just do: awk -F '|' '/[.]doc/ {print toupper($2)}' datafile |
|
||||
|
Hi again,
thanks for the feedback...I used nawk as suggested and it worked. awk -F '|' '/[.]doc/ {print toupper($2)}' datafile is definitely simpler than what I have...I'm a newbie to unix scripting so I of course made something more complicated than it should be thanks for the help ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|