![]() |
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 |
| Or operator with if | babom | HP-UX | 1 | 10-03-2007 03:56 PM |
| Bit shift operator | naan | High Level Programming | 5 | 09-08-2006 02:13 AM |
| And operator | rcarnesiii | Shell Programming and Scripting | 4 | 08-04-2005 02:04 AM |
| Problem about c++ new operator | xbjxbj | High Level Programming | 3 | 04-27-2005 05:17 AM |
| Operator question | TheCrunge | UNIX for Dummies Questions & Answers | 5 | 03-01-2005 03:27 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
We are calling Unix through SQR.
I want to know there is any operator available in Unix ...so that the remaining command should go to the next line I will explain , find the below code . It is in single line which is coded as single variable in SQR and called using 'call system using ' command.....now i want 'the operator or command" which will devide the code and print like Step 2.(actually i want to use that command before 'if ' below ....) Step1 : (single Line) awk '{gsub(/^\|| +\|/,"") if(NF!=10){for(i=1;i<=(10-NF);i++)printf("%s|",k[i]);print;next}{for(i=1;i<=3;i++)k[i]=$i}print}' FS='|' file Step 2: ( two lines ....2 nd start with 'if' ) awk '{gsub(/^\|| +\|/,"") if(NF!=10){for(i=1;i<=(10-NF);i++)printf("%s|",k[i]);print;next}{for(i=1;i<=3;i++)k[i]=$i}print}' FS='|' file |
|
||||
|
Error coming :
awk '{gsub(/^\|| +\|/,"") a\ if(NF!=6){for(i=1;i<=(6-NF);i++)printf("%s|",k[i]);print;next}{for(i=1;i<=3;i++)k[i]=$i}print}' FS='|' key.txt
awk: cmd. line:1: {gsub(/^\|| +\|/,"") a\ if(NF!=6){for(i=1;i<=(6-NF);i++)printf("%s|",k[i]);print;next}{for(i=1;i<=3;i++)k[i]=$i}print} awk: cmd. line:1: ^ backslash not last character on line The above error is coming ....... I think u understood the requirement .....we have to use the operator so that from 'if' to till the end ...sholud be treated as new line. I dont know why error is coming even if the entire code is on single line ... |
|
||||
|
what exactly is the problem here?
If you want all of it on a single line, end the gsub func call with a semicolon ( , before the if.. starts. You need to use the backslash as the last character of the line if you need to spread the awk string across more than one lines. maybe i didnt understand what is your issue, can you elaborate? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|