This is wrong since it modifies line outside of the designated range by indiscriminately deleting dots.
If, as I suspect, the dots in the data are placeholders for irrelevant data, then this solution which depends on literal dots is wrong in a second way.
Regards,
Alister
---------- Post updated at 01:14 PM ---------- Previous update was at 12:27 PM ----------
Quote:
Originally Posted by MadeInGermany
Must be > not \>. The latter has a special meaning "right word boundary" in many sed versions.
I'm curious. Besides GNU (and perhaps Busybox, which emulates GNU whenever their minimalist mission allows), which sed implementations support \>?
Quote:
Originally Posted by MadeInGermany
Here is another sed solution (IMHO ugly compared to the awk solution):
That sed script is not equivalent to the awk solution. If the data ends when in mid-range, it will print (accumulated) lines which the awk alternative would not have.
Not a one-liner, but it's the most straightforward approach which behaves analogously:
Regards,
Alister
These 3 Users Gave Thanks to alister For This Post:
Hi all,
I have the following data in a file x.csv:
> ,this is some text here
> ,,,,,,,,,,,,,,,,2006/11/16,0.23
> ,,,,,,,,,,,,,,,,2006/12/16,0.88
< ,,,,,,,,,,,,,,,,this shouldnt be deleted
I need to use SED to match anything with a > in the line and delete that line, can someone help... (7 Replies)
I am really need help with the regular expression in SED. From input file, I need to extract lines that have the port number (sport or dport) as defined. The input file is something like this
time=1209515280-1209515340 dst=192.168.133.202 src=208.70.8.23 bytes=2472 proto=6 sport=80 dport=1447... (6 Replies)
I want to delete lines like this
sed '/FROM_HERE/,/TO_HERE/d'
but I would like to *not* delete the second match, i.e. the TO_HERE line. How can I achieve this?
Thank you! (1 Reply)
Friends,
I have .txt file with following format.
START
ABC|Prashant1|Patel1
ABC|Prashant2|Patel2
ABC|Prashant1|Patel1
ABC|Prashant2|Patel2
END
I would like to do:
1) Delete line with START
2) Delete line with END
3) Remove ABC|
4) Delete duplicate records
The following command... (7 Replies)
I have an ugly conf file that has the string I'm interested in searching for in the middle of a block of code that's relevant, and I'm trying to find a way to remove that entire block based on the matched line.
I've googled for this problem, and most people helping are only interested in... (9 Replies)
Hello Friends,
I need to print lines in between two string when a keyword existed in those lines (keywords like exception, error, failed, not started etc).
for example,
input:
..
Begin Edr
ab12
ac13
ad14
bc23
exception occured
bd24
cd34
dd44
ee55
ff66
End Edr (2 Replies)
Hello,
I have been trying to write a script where I could get awk to delete data before and after a matched pattern.
For eg
Raw data
Start
NAME = John
Age = 35
Occupation = Programmer
City = New York
Certification Completed = No
Salary = 80000
End
Start
NAME = Mary
Age = 25... (2 Replies)