Results 1 to 4 of 4
hi
can anyone please help me to write a sed script with following requirements.
delete all the lines in a file that ends with either alpha, beta or gamma.
i ...
- 03-31-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
Sed script.
hi
can anyone please help me to write a sed script with following requirements.
delete all the lines in a file that ends with either alpha, beta or gamma.
i can write 3 different statements for it but i wnt to combine it in one statement. help me plz
sed 's|[/a-z A-Z_0-9.-]*alpha$| |' File.txt
sed 's|[/a-z A-Z_0-9.-]*beta$| |' File.txt
sed 's|[/a-z A-Z_0-9.-]*gamma$| |' File.txt
thanks in advance.
- 03-31-2009 #2Linux Newbie
- Join Date
- Mar 2009
- Posts
- 228
Use extended regexs. You'll have to use the -r option:
-r, --regexp-extended
use extended regular expressions in the script.
Code:sed -r 's|[/a-z A-Z_0-9.-]*(alpha|beta|gamma)$| |' File.txt
- 04-01-2009 #3Just Joined!
- Join Date
- Mar 2009
- Posts
- 2
Thanks, its working now. Thanks again.
- 04-01-2009 #4Just Joined!
- Join Date
- Apr 2009
- Posts
- 2
i dont create new topic, so i will write there.
i have a problem with my script using sed.
bash script must prints out the number of usernames that begin with each letter of the alphabet from some file.
But: sed -e 's/\.//g' -e 's/ /\
/g' "$1" | tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr print and count the lines,but not first letters.


Reply With Quote