I would like to write a script that takes something like this:
Line 1
Line 2
Line 3
Line 4
[Blank line]
Line 6
Line 7
Line 8
Line 9
[Blank line]
etc....
And makes it to look like this:
Line 1|Line 2|Line 3|Line 4|[Blank line, if it's easier]
Line 6|Line 7|Line 8|Line 9|[Blank line, if it's easier]
etc.
I would think it would be fairly easy to use two loops, one for the the 5-li
Assume I have a big file, ~1k lines, and I need to delete the line after some pattern, lets call it: somePatern.
Conditions:
cannot be done by hand (no searching -- /somePattern, and/or manually moving down one line and deleting).
preferably a single liner.
In vim, I sometimes have occasion to replace the first few occurrences of a match on a line, but not every one like g would.
How can I trim a file (well input stream) so that I only get the lines ranging from the first occurrence of pattern foo to the last occurrence of pattern bar?
For instance consider the following input :
A line
like
foo
this
foo
bar
something
something else
foo
bar
and
the
rest
I expect this output:
foo
this
foo
bar
something
something else
foo
bar
How can I write a script that takes a cisco config file and outputs every occurrence of two, or more, pattern matches through the whole config file?
For example, out of a config file, i want to print out every line with interface, description and ip address through the whole file, and disregard anything else.
Example:
interface Loopback1111
description aaaa
ip vrf forwarding vaaaa
ip address
I have problem with this for last few days and I would really be grateful if you can help me :wall::wall::wall::wall::wall:
I have sets of files in one directory, and each of them have few lines
each one of these lines has 1 or more occurrence of words
Y = [Dean James John Mark Bob]
I need to find the position of the Y in each line and put them into a file with number of the words in the whole l
I have a file with dups records (dups are in columns).
I would like to remove carriage returns/line feeds in a text file, but in a specific cadence:
Read first line (Header Line 1), remove cr/lf at the end (replace it with a space ideally);
Read the next line (Line of Text 2), leave the cr/lf intact;
Read the next line, remove the cr/lf;
Read the next line (Header Line 2), remove cr/lf at the end (replace it with a space);
Read the next line (Line of
Hi,
I have a file as below
This is the line one
This is the line two
<\XMLTAG>
This is the line three
This is the line four
<\XMLTAG>
Output of the SED command need to be as below.
This is the line one
This is the line two
<\XMLTAG>
Please do the need to needful to get the desired output.