simple parsing (ksh scripting)
I want to parse a string as below
Code:
-c abcdefg -d hijklmnop -e abracadabra 1234 -f gmail Code:
abracadabra.1234 Can someone help me out. |
One way -
Code:
echo $@ | awk '{ split($0,arr, " ") |
GNUawk
Code:
# s="-c abcdefg -d hijklmnop -e abracadabra 1234 -f gmail" |
I didn't wanted to use a while loop for this tasks.
When I run the other code, I get an error that gensub is not defined. I started off just to extract the matched word. But when I run this, I get an error Code:
echo "$S" | sed 's/-e.*-/\1/' |
Got it - I am pasting the code below. Sed is used to remove anything before -e (including -e and spaces after it) + removing anything after -(including spaces before it). Then I use tr to squeeze spaces between and replaces them with '.'
Quote:
|
All times are GMT -5. The time now is 03:13 AM. |