If you're looking for strings starting with PUC-AP_ and ending with ;, that doesn't match the output specified in post #1, but this seems to work:
which, with the sample input from post #1 produces the output:
If you're looking for strings just starting with PUC and ending with ;, (which comes closer, but still does not exactly match the requested output), change the line in the script above:
to:
Then the modified script produces the output:
If you want to try this script on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk.
Hi Experts,
I have a string with colon delimited, want 2nd colon to be changed to a pipe.
data:
101:8:43:4:72:14:41:69:85:3:137:4:3:0:4:0:9:3:0:3:12:3:
I am trying with sed, but can change only 1 occurance:
echo "101:8:43:4:72:14:41:69:85:3:137:4:3:0:4:0:9:3:0:3:12:3:" | sed 's/:/|/2'... (5 Replies)
Dear Experts,
How to use field separator in awk , when the field separation is needed as "||"
Example: (file1 )
aa || bb || cc || 1234
xx || yy || zz || 1123
Q:
If I want to print $3 and $4 only , with using the field separator "||"
How to write awk code: (6 Replies)
logs:
"/home/abc/public_html/index.php"
"/home/abc/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
how to use "cut" or "awk" or "sed" to get the following result:
abc
abc
xyz
xyz
xyz (8 Replies)
Is there any way to get the escaped version of a field in awk? For those that don't understand the question, here is a clarifying example. Lets say a field $1 gives me the string "(dumb'" (I've changed the delimiter to be something other than whitespace). If i use that value in a command in awk... (2 Replies)
Hi,
I am trying to insert a "_" character in front of capital letters in a string. For instance:
HappyDaysAreHereAgain
needs to become
Happy_Days_Are_Here_Again
I know how to do this with sed, but I am writing an awk script, which does several things. Also, I have already set FS in order... (9 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
I guess it was getting a little messy on the other post so here goes:
Link to previous post for Question:
https://www.unix.com/shell-programming-scripting/111338-awk-replace-particular-field.html
Continuation of Question
hey i was messing around a bit ... made me wonder...
If the... (1 Reply)
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)