![]() |
|
|
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 |
| regex to remove text before&&after comma chars | yomaya | Shell Programming and Scripting | 3 | 06-08-2009 06:44 AM |
| How to remove comma from the last line of the file | sandeep_1105 | UNIX for Dummies Questions & Answers | 5 | 05-27-2009 01:01 PM |
| Delete a comma from string | MisterKhan | Shell Programming and Scripting | 6 | 03-26-2009 03:36 PM |
| remove unnecessary comma from file | sumeet | UNIX for Advanced & Expert Users | 1 | 12-31-2008 06:00 PM |
| Remove whitespaces between comma separated fields from file | nitinbjoshi | UNIX for Dummies Questions & Answers | 2 | 06-14-2008 09:14 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Agreed but the OP was using awk anyway to transform
Code:
UID: ABC345QWE678GFK345SA90, LENGTH 32 Code:
ABC345QWE678GFK345SA90, Code:
ts="UID: ABC345QWE678GFK345SA90, LENGTH 32"
ts=${ts#*:}
echo "${ts%,*}"
|
|
||||
|
Quote:
Code:
ts="UID: ABC345QWE678GFK345SA90, LENGTH 32"
ts="${ts%,*}"
echo ${ts#*:}
Code:
echo "UID: ABC345QWE678GFK345SA90, LENGTH 32"|awk '{sub(",","");print $2}'
Code:
echo "UID: ABC345QWE678GFK345SA90, LENGTH 32" | sed 's/.* \(.*\),.*/\1/' |
|
||||
|
Thanks for you replies.
I had an executable file name " uid.out" that generates following ouput when i call it from the shell script. "Home" is the string that i passed as input to the string. Using Prod Key Trying to Encrypt: home UID: 8C42A3DA2A9BFB9D8E89E4FA9C9FE161, length: 32 Now i want to extract the 8C42A3DA2A9BFB9D8E89E4FA9C9FE161 into variable. what i did was uid.out "Home" |grep UID >> temp.txt =$( awk '{FS=" "} {print $2}' temp.txt) echo "${Ecode} produces the ouptut 8C42A3DA2A9BFB9D8E89E4FA9C9FE161, in which I am not able to seperate Coma(,) at the end string. What am i doing wrong? thanks in advance. |
|
||||
|
Reddy, have you tried any of the solutions? Leaving optimizations of your code aside, there are close to a gazillion solutions to your problem in this thread. If you are having trouble choosing then just pick one.
Last edited by Scrutinizer; 3 Weeks Ago at 12:56 PM.. |
|
|||||
|
You are not paying close attention to the scripts posted here.
Quote:
Code:
uid.out "Home" | awk -F '[ ,]' '/UID/ {print $2}'
Code:
uid.out "Home" | awk -F "[ ,]" '/UID/ {print $2}'
Code:
uid.out "Home" | awk 'BEGIN{FS="[ ,]"} /UID/ {print $2}'
Code:
uid.out "Home" | perl -lne '/^UID: (\w+),/ && print $1' |
|
|||||
|
Quote:
|
| Bits Awarded / Charged to cfajohnson for this Post | |||
| Date | User | Comment | Amount |
| 3 Weeks Ago | Reddy482 | N/A | 516 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|