how to use grep/sed
I have a text file I'm trying to split up into multiple files.. the format is like this:
Code:
O1234 (filename.ext) I'm not even sure where to start on this.. Any help would be greatly appreciated. Thanks -Tom |
It's not sed but
Code:
filename= |
And an awk-version ... :}
Code:
BEGIN{ Cheers, Tink |
There are four great tools in the Unix/Linux world that are terrific for handling problems like these. I'll introduce them individually....
sed ("stream editor") is very useful when you have a single file that you want to do something to, to produce another single file as output. (In Linux/Unix-land, this idea is often applied as a "filter" when "piping" things ... but that's another story...) grep is a great tool for finding which files contain a particular string. It grows on you... For example, when I needed to find all of the files in a great-big directory (which contains over 3,500 files in various subdirectories) which contained the word "arp" as a whole-word (that is to say, surrounded on both sides by a character that is not a letter), regardless of UPPer or LoWeR CAse, I "merely" typed: grep -rilw arp ~/projects/* Nothin' to it... ;) awk is probably the tool that you want in this case. The file that you need to process has certain definitely-identifiable characteristics, such as:
For the truly adventurous, the programming language perl was actually designed by a person who started his quest by "extending awk" and ... well ... "one thing lead to another," as things in our peculiar industry so-often do. |
All times are GMT -5. The time now is 08:05 PM. |