Please enable JavaScript of your browser.
Patterns
Line-based
New Scripts
Two Patterns
Consecutive Lines
Mail Issues
Lines Containing
PAT
and Adjacent Ones.
N
-th Line Containing
PAT
First Line Containing
PAT
Last Line Containing
PAT
Append/Join Conditionally
Reformat a File
Two-file Issues
Misc
New Scripts
Edit the second file according the words and replacements specified in the first one.
2010.05.31
Two Patterns
Get lines containing
PAT
1
AND
PAT
2
of a file.
2000.11.16
Get lines containing
PAT
1
OR
PAT
2
of a file.
2000.11.17
Get lines containing
PAT
1
but no
PAT
2
of a file.
2000.09.29
Insert a separating line after a line beginning with 'abc' and immediately followed by a line beginning with 'xyz'.
2005.07.29
Perform operations on lines starting from the fist line containing
PAT
1
till the last one containing
PAT
2
.
2008.01.24
Consecutive Lines
Delete two consecutive lines if the first one contains
PAT
1
1, and the second one contains
PAT
2
.
2007.12.31
Remove almost identical lines.
2008.01.21
For consecutive `almost identical' lines, print only the first one.
2008.11.28
Remove consecutive duplicate lines.
2008.02.21
Retrieve the first line among consecutive lines of the same key.
2008.08.25
Mail Issues
Extract 'Received:' headers from a mailbox.
2004.05.16
Add a separator after each header field of a mail.
2009.08.06
Extract matched headers of a mail.
2009.12.25
Gather information of a mail transaction.
2010.01.26
Lines Containing
PAT
and Adjacent Ones.
Get every line containing
PAT
and the adjacent one preceding it.
2008.02.09
Get every line containing
PAT
, the preceding, and the following ones.
2009.03.31
Get lines containing
PAT
and 3 consecutive lines following each of them.
2000.11.15
Get every line which is adjacent to and precedes a line containing
PAT
.
2001.02.13
Get the line following a line containing
PAT
.
2004.02.17
Delete every line containing PAT and the next three lines.
2009.07.30
N
-th Line Containing
PAT
Get the
N
-th matched line.
2007.08.23
Get the
N
-th matched line.(another version)
2007.09.03
Get the
N
1
-th,
N
2
-th,
N
3
-th, ..., matched lines.
2010.04.30
First Line Containing
PAT
Get the FIRST line containing
PAT
2000.09.29
Delete the FIRST line containing
PAT
of a file.
2000.09.29
Get lines starting from the FIRST one containing
PAT
till the end of file.
2000.10.18
Delete up to, but not including, the first line containing
PAT
.
2001.02.17
Last Line Containing
PAT
Get the LAST line containing
PAT
of a file.
2000.10.04
Delete the LAST line containing
PAT
of a file.
2008.08.06
Among lines containing PAT, delete all but the last one of them.
2009.07.28
Get the lines from the LAST one containing
PAT
of a file.
2006.06.22
Get the lines after the LAST one containing
PAT
of a file.
2006.06.28
Delete the lines from the LAST line containing
PAT
till the end of file.
2006.07.19
Delete the lines till the LAST one containing
PAT
.
2007.09.05
Perform a specific operation on lines starting from the beginning of a file till the LAST line containing
PAT
.
2007.01.18
Among lines with the same key, print the last one.
2009.08.03
Append/Join Conditionally
If a line does not end with a dot ('.'), join every following line till one ending with a dot.
2001.02.26
A case study on joining lines.
2004.09.29
Join every three non-blank lines to one line, separate them by '|'s.
2004.02.12
Append a line to the previous one if it does not begin with some tag.
2006.09.13
Join together all lines except the last one.
2008.08.12
Prepend a block to a file if it does not exist.
2009.07.14
Reformat a File
Split lines that are longer than 25 characters.
2001.06.22
Move lines containing some string to the end of a file.
2002.12.04
Fix newlines at wrong positions.
2004.03.04
Add a separator line to the end of every 'block'.
2002.10.04
Append a message after very 'block'.
2004.09.10
If a non-blank line is not followed by a blank line, append a <br> tag to the end of it.
2006.05.22
Show complete records only.
2007.06.12
Substitute the section specified in File
1
for the same section in File
2
.
2008.08.18
Two-file Issues
List records of File
2
whose keys are not listed in File
1
.
2008.08.29
Update entries of File
2
according to File
1
.
2009.05.29
Edit the second file according the words and replacements specified in the first one.
2010.05.31
Misc
Get the longest line of a file.
2000.10.11
Retrieve IPs and interface names from the output of /sbin/ifconfig.
2003.02.21
Comment out uncommented lines.
2004.02.27
Prepend the contents of some file before every matching line of a file.
2005.10.18
Print the last line of each group consisting of lines with the same tag.
2003.01.28
Replace every instance of 'KEY=....' of a file with the first one.
2004.06.08
Print `ODD' if there are odd number of lines containing
PAT
in the datafile.
2008.06.23
Convert a file listing to FTP commands.
2008.12.23
Reformat a datafile.
2009.03.04
Delete shell-style comment lines and empty ones.
2009.03.26