hi i have a file in the below fomat
I want to remove the comment of the parameters but not the header...i want the file in the below format
I have used
but this uncommenting the header also and giving me
is there any way to start replace only after the line after "file value" ie ,if i get the file value line number (in this case 5), can we ask the sed to start replacing only after 5 th line till the end of the file
is there any way to start replace only after the line after "file value" ie ,if i get the file value line number (in this case 5), can we ask the sed to start replacing only after 5 th line till the end of the file
This User Gave Thanks to balajesuri For This Post:
i do not have perl or else perl command was a good solution here
Thanks balajesuri...the sed is working
but for getting the line number of the pattern "file value" ...im using
but this giving me a line with
from that i need to cut the line number, is there any way i can get line number using single command
---------- Post updated at 06:37 AM ---------- Previous update was at 06:07 AM ----------
is there a way to parameterise the number to be passed in the sed, like in
when i give
Last edited by Franklin52; 06-14-2012 at 08:44 AM..
Reason: Please use code tags for data and code samples
I know this is not a sed solution but in vim you can do a range based search replace. That way you can see what you have done and then undo if you don't want to keep that change..
open file in vim and do the following:
Then if you don't like what it did:
To explain...
The ":" places you in command mode in vi/vim. The "6,$" is telling vi/vim to start at line "6" and end at "$" (end of file). Then the "s/^#//" tells vi/vim that we are doing a search/replace operation. Searching for "#" at the beginning of the line (^) and then in the replace side we leave blank to remove the "#" if found.
Just like sed, "s/<search>/<replace>/" uses regex. You can use regex patterns as normal in the search side. It even supports keeping part of the found string as in sed. Use "(" and ")" in the search and "\1" in the replace.
The undo is easy... simply make sure you are not in command mode by hitting the "ESC" key and then hit "u" to undo your changes (Ctrl+r for redo).
Shell script logic
Hi
I have 2 input files like with file 1 content as (file1)
"BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt
File 2 contents as fle(2)
"BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt
I want to get... (22 Replies)
Hi,
I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file.
File1 - file2 = file3
wc -l file1.txt
58112
wc -l file2.txt
55260
head -5 file1.txt
101214200123
101214700300
101250030067
101214100500... (10 Replies)
Hi Friends,
I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving...
File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)