searching multiple lines and replacing in shell scripting
Hi,
I have a file with below contents,
I want to search for "ssenthil" and need to delete line 1 and 2 , if the third line starts with "[" or blank line.
I need to perform with following steps
1 - searching "ssenthil" and deleting the line.
2 -Now i want to delete by the option that the line starts and end with "[" and "]" respectively and blank line immediately and third line starts with "[" should delete the first two lines.
to get the output as below
Please help me .
Great day
Anil.G
Last edited by radoulov; 05-19-2011 at 10:19 AM..
Reason: Code tags.
Hello All,
just wanted to export multiple tables from oracle sql using unix shell script to csv file and the below code is exporting only the first table.
Can you please suggest why? or any better idea?
export FILE="/abc/autom/file/geo_JOB.csv"
Export= `sqlplus -s dev01/password@dEV3... (16 Replies)
Experts,
Can someone help me with the below?
I've a variable called NSPMHOME=some_value. I would like change the value of the variable with another variable and something followed by it.
E.g
From NSPHOME=some_value to NSPMHOME=$SOMETHING/test
$SOMETHING has value /opt/tag .
The end... (4 Replies)
Hi
Am confused with the usage of "sed" command
I want to replace a single line with multiple lines of a file..
eg.,
A file has
Hi, How are you?
I need to replace as
Am fine
What are You doing?
I used the script as
string1="Hi, How are you?"
echo "$string1 is the value"... (4 Replies)
Background:
I am writing a script to help me automate tweaks and things I apply to a custom Android rom I developed. I am on the very last part of my script, and I am stuck trying to find the right command to do what I seek.
When I build roms from source, a file called updater-script is... (8 Replies)
I use this command to find a search (Nr of active alarms are) and print one line before and 10 lines after the search keywords.
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print;c=a}b{r=$0}' b=1 a=10 s="Nr of active alarms are:" *.log
However, I would like to know how to tell it to print... (3 Replies)
This is the problem actually:
This regex:
egrep "low debug.*\".*\"" $dbDir/alarmNotification.log
is looking for data between the two quotation marks:
".*\"
When I hate data like this:
low debug 2009/3/9 8:30:20.47 ICSNotificationAlarm Prodics01ics0003 IC... (0 Replies)
Can any one give me the idea on replacing multiple blank lines with a single blank line?
Please conside it for a file having more than 100 number of characters.
Regards,
Siba (3 Replies)