C
charissaf
Hello,
FreeBSD 4.10
#!/bin/ksh
I'm looking for some guidance on how to use a combination of grep and
xargs to find lines in multpile files beginning with > and append them
to the previous line.
For example, ideally I would like to use:
grep -r -l '^>' . | xargs perl -pi -e :a -e '$!N;s/\n>/>/;ta' -e 'P;D'
I am basing this one liner on the following sed example:
# if a line begins with an equal sign, append it to the previous line
# and replace the "=" with a single space
# sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D'
The error I receive is: N: Event not found.
A sample file would have a line similar to
<htm
The ideal result is to bring the closing > up to the preceeding line:
<htm>
Please look at my syntax or let me know if there is another way of
doing this operation using xargs perl.
Thank you!
C
FreeBSD 4.10
#!/bin/ksh
I'm looking for some guidance on how to use a combination of grep and
xargs to find lines in multpile files beginning with > and append them
to the previous line.
For example, ideally I would like to use:
grep -r -l '^>' . | xargs perl -pi -e :a -e '$!N;s/\n>/>/;ta' -e 'P;D'
I am basing this one liner on the following sed example:
# if a line begins with an equal sign, append it to the previous line
# and replace the "=" with a single space
# sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D'
The error I receive is: N: Event not found.
A sample file would have a line similar to
<htm
The ideal result is to bring the closing > up to the preceeding line:
<htm>
Please look at my syntax or let me know if there is another way of
doing this operation using xargs perl.
Thank you!
C