Feb 6, 2004, 11:39 AM
Post #1 of 2
I want to open up all files and check the first 10 lines to see if it has a certain entry (timestamp)....if it doesn't - I want to add this:
...HOW DO YOU DO THIS from the command line???ahhhh
[% # ID: timestamp %]
so basically, I have to traverse many different directories and open two types of files (.html and .htm) - check them for the test and write to them if they don't have the timestamp...the timestamp would look like this..
if it doesn't have that...add what I wanted, else leave alone.
I have this code
Using this regular expression from the command line
find . -type f -name "*.html" |xargs perl -i.bak -pe 's~\[% urlserver %]/images/files/ ~[% urlserver %]/images/files/sub/~g' *.html
basically..the above line just checks for a path of file, and if it exists change it to the one given..
can this be modifed to do what i need?