[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: automated editing of text files



Hi Tom (and others)

>> linbobo:~/sedtest# sed 's_\n<pre>\n_\n<pre>\n\n_' <original.txt 
>> >new.txt linbobo:~/sedtest# less new.txt

> You want to change the regexp here. In regular expressions '^' matches
start of line and '$' matches end of line.
> Your sed instruction above should be something like 's/^<pre>$/<pre>\n/',
or more generally 's/^\(<pre>\)$/\1\n/'.

Ok, I've got most of it. The last part is more of a bash problem I think as
most of the files have spaces in them. Not my idea, it's how the files were
delivered to me. :-(

So the command line:
  for i in `ls *.txt` ; do ./add-pre-nl.sh $i; done
does not cut it as it chops the filesnames up and issues each part to the
add-pre-nl script. :-(
If I just use
  ./add-pre-nl.sh file\ name\ with\ spaces.txt
it will produce the result I want.

Does someone know the solution or should I ask in a bash Group?

Bonno




Reply to: