[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help with sed
From: |
Radim |
Subject: |
Help with sed |
Date: |
Fri, 16 Apr 2010 01:22:24 -0700 (PDT) |
Hello,
I have such script:
(ONLY THIS THREE LINES ARE THE COMMANDS )
content=$(cat $script | sed '/function codecs/,/fi;/d');
content=$(echo $content | sed -n '/mandriva/,/fi;}/p');
content=$(echo $content | sed '/^\s*urpmi[:space:]--auto/p');
But it doesn't work as I would expected.
This is the text structure in file, that I need to filter:
(THIS IS A TEXT TO OUTPUT! TO FILTER)
function codecs {
if [ ".." == "mandriva" ]; then
urpmi ... ;
urpmi ... ;
if [ ".." == "kubuntu" ]; then
deb .... ;
deb ...;
fi;
}
function name1 {
if [ ".." == "mandriva" ]; then
urpmi ... ;
urpmi ... ;
if [ ".." == "kubuntu" ]; then
deb .... ;
deb ...;
fi;
fi;
}
function name2 {
if [ ".." == "mandriva" ]; then
urpmi ... ;
urpmi ... ;
fi;
}
What I try to do:
1) To delete the codecs function of the output.
2) To get the "if mandriva" block
3) from that block to get lines of urpmi
Anybody help?
--
View this message in context:
http://old.nabble.com/Help-with-sed-tp28264280p28264280.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.