Skip to content
Peter Ajtai edited this page Jul 17, 2013 · 10 revisions
# remove untracked files in mercurial
hg status | grep ^? | awk '{print $2}' | xargs rm

# divide test.log into numbered files based on regex
# to include the line w the regex, leave out "next"
awk -v n=1 '/regexGoesHere/{close(n);n++;next} {print > n}' test.log

# using gawk and a string - version number is padded w zeroes w all log files
LC_ALL=C gawk -v RS='seprator' -v ORS= '{print > "file."sprintf("%03d",NR)}' *.log

# further e.g.
LC_ALL=C gawk -v RS='] Setting User Agent = ' -v ORS= '{print > "chunks/out."sprintf("%05d",NR)".log"}' *.log

Linked from:

Linux Commands

Total of 183 pages.
Total of 67 pages not in main tree.
Total of 147 nodes.
This Sidebar and the "Linked From" sections created by Wiki Buddy
The full tree is at _WB-Full-Tree

Clone this wiki locally