below command works for me but can you please explain me . I am not able to understand it. like what is the use of
In sed, and other tools such as grep and awk, [] is a character class - a character that can match anything inside the brackets. This can be a list, a range, or a combination of the two. If the first character after the left bracket is a carat (^) you invert the class, so the above matches anything except the comma. The asterisk is a special character that tells sed to match the previous character zero or more times. So [^,]* could match anything up to and not including a comma, or anything after a comma.
Quote:
delete
Quote:
Change comma to space
Quote:
Delete all strings in the line that don't include the comma and end in ": ";
Change all commas to spaces.
I have entries like below in a file
11.22.33.44:80
22.33.44.55:81
:::587
:::465
What I need is to take out the part after colon ( : )
Output should be as follows.
80
81
587
465
I used cut -d: -f 2 but its not working as dedired. (2 Replies)
Ok I would like to do the following
file test contains the following lines. between the lines ABC there may be any amount of lines up to the next ABC entry.
I want to grep for the filename.txt entry and print the lines in between (and including that line) up to and including the last line... (3 Replies)
There was a sample code on forum I found sometime back:
$ f() { local foo=; : ${foo=unset}; declare -p foo; }; f
declare -- foo=""
$ f() { local foo; : ${foo=unset}; declare -p foo; }; f
declare -- foo="unset"
Can someone explain why was colon (:) is being used here. Whats its use? (4 Replies)
Hi I have a requirment here. I have to out the string after the particular word. for example i have the to extract the first word after the word disk. help me out. i have tried the folloing code but it is not giving the output which i need.
awk -F"*disk " '{print $1}'
grep -n -o '' file
Input... (2 Replies)
Hi,
Is there a way in Korn Shell that I can run multiple commands stored as a semi-colon separated string, e.g.,
# vs="echo a; echo b;"
# $vs
a; echo b;
I want to be able to store commands in a variable, then run all of it once and pipe the whole output to another program without using... (2 Replies)
i have a file that looks like this
ABC123
aaaaaaaaaaaaaaasssssssssssssssffhhh
ABC234
EMPTY
ABC652
jhfffffffffffffffffffffffffffffffffffkkkkkkkkkkkk
i want to grep "EMPTY" and print ABC234 (3 Replies)
Dear All,
I am new to shell script.I want to print following string:
"E:\OutputRef\ExtendedTestObjectModel\Test.txt"
For that i am using:
echo "$ADL_ODT_REF${ADL_ODT_SLASH}ExtendedTestObjectModel${ADL_ODT_SLASH}$ResultFile"
where - $ADL_ODT_REF is E:\OutputRef
$ADL_ODT_SLASH... (5 Replies)
How to print the strings within a line between two spaces .
<ns1:providerErrorCode>141</ns1:providerErrorCode> <ns1:providerErrorText>business_rule_exception-Server.404:Cannot proceed because the subscriber with phone number is either suspended or the account has an unpaid... (8 Replies)
I know how to grep, copy and paste a string from a line. Now, what i want to do is to find a string and print a string from the line below it. To demonstrate:
Name 1: ABC Age: 3
Sex: Male
Name 2: DEF Age: 4
Sex: Male
Output:
3 Male
I know how to get "3". My biggest problem is to... (4 Replies)
Hi, all,
I wonder if I can use sed to insert a string which has a colon.
I have a txt file a.txt like the following
TRAIN/DR1/FCJF0/SI1027.MFC
TRAIN/DR1/FCJF0/SI1657.MFC
I want to insert a string C:/TIMIT/TIMIT at the begining of each line.
I use the commond:
TIM=C\:/TIMIT/TIMIT... (2 Replies)