![]() |
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 |
| create PATH from find command output | rein | UNIX for Dummies Questions & Answers | 3 | 04-01-2008 07:35 AM |
| trying to create a script with multiple variables... | Italy87 | UNIX Desktop for Dummies Questions & Answers | 5 | 03-21-2008 02:09 PM |
| parse multiple lines? should be a easy answer... | DeuceLee | UNIX for Dummies Questions & Answers | 4 | 01-04-2008 04:54 PM |
| Create Variable for a PATH | mmignot | Shell Programming and Scripting | 2 | 11-06-2006 03:09 PM |
| Create Folder in Multiple Directories | Stud33 | Shell Programming and Scripting | 15 | 07-20-2006 03:44 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Parse value from multiple row to create the path
Hi all,
Hope all the expert can help me in this situation. Let say I have one file with multiple record like below: [10001] NAME=FRAGMENT LANGUAGE=1 DIALECT=0 GENDER=NONE FILE=TEST1 DIRECTORY=D:/DETAILS/1/0/test1.txt END [10002] NAME=FRAGMENT LANGUAGE=1 DIALECT=0 GENDER=NONE FILE=TEST2 DIRECTORY= END [10003] NAME=FRAGMENT LANGUAGE=1 DIALECT=0 GENDER=NONE FILE=TEST3 DIRECTORY= END For each record, I need to generate the path for DIRECTORY where, - D:/DETAILS/ is fixed - 1 is taken from LANGUAGE=1 - 0 is taken from DIALECT=0 - test1 is taken from FILE=TEST1 - test1 must be SMALL LETTER Since in the file there are huge amount of records,so I think may be can use script to generate the path for each record. But getting stuck for the script now. Please advise. Thank you so much. Best Regards, Shirley |
|
||||
|
Error while execute the command
Hi Klashxx,
I get the below error when execute the command: awk: syntax error near line 1 awk: bailing out near line 1 Try to solved it many times already but still getting the same error. Please advise. Thank you. Best Regards, Shirley |
|
||||
|
Quote:
nawk -F"=" '/DIRECTORY/ {print $1"=D:/DETAILS/"a["LANGUAGE"]"/"a["DIALECT"]"/"tolower(a["FILE"]);next}a[$1]=$2{}1' file.txt |
|
||||
|
Error while execute the command
Hi Klashxx,
Yup, is Solaris box. Hi DILEEP410, The command is ok but it didnt return the path that I want, the LANGUAGE, DIALECT and FILE value are missing. Please advise. RESULT: [10001] NAME=FRAGMENT LANGUAGE=1 DIALECT=0 GENDER=NONE FILE=TEST1 DIRECTORY=D:/DETAILS/// END Thank you. Best Regards, Shirley |
![]() |
| Bookmarks |
| Tags |
| solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|