![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| | help | unix | grep (GNU grep) 2.5.1 | advanced regex syntax | MykC | UNIX for Dummies Questions & Answers | 4 | 10-15-2009 10:52 AM |
| | help | unix | grep - Can I use grep to return a string with exactly n matches? | MykC | UNIX for Dummies Questions & Answers | 7 | 10-13-2009 01:57 PM |
| MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else | hariza | Shell Programming and Scripting | 4 | 09-18-2008 02:56 AM |
| grep and fetching lines after grep | arghya_owen | Shell Programming and Scripting | 2 | 07-16-2008 07:25 AM |
| Make grep -c display like grep -n? | Jerrad | Shell Programming and Scripting | 2 | 08-25-2006 12:20 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi
My input file looks like as follows: say a.txt Code:
"aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" "aaaa cc","224 AW","ss cccccc","P06 09/10","dddddd" Code:
1 AW 2 AS ..... Code:
aaaa 2242009W1000001(last 5 characters -> 00001 is look up value for AW from b.txt). Code:
sed -e 's/ /,/g' -e 's/\//,/g' -e 's/"//g' a.txt|awk -F"," '{printf "%-10s%3s%s%s%s%s\n",$1,$3,"20",$8,"W",$9}'
Thanks in Advance. Last edited by radoulov; 2 Weeks Ago at 09:21 AM.. Reason: Use code tags, please! |
|
||||
|
Sure:
If $3 does not exist (in other words: if the input originates from b.txt) then set the array A with key $2 to the value of $1. next means skip the next commands and re-enter the loop. The rest of the code gets executed when $3 contains a value, i.e. when the input originates from a.txt. |
|
||||
|
Thanks Scrutinizer....Understood much better now..
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| awk, cut, grep |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|