Afficher un message
Vieux 17/08/2006, 18h18   #3
Xicheng Jia
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Need to delete the next line in a file

heynetboy wrote:
> Hello -
>
> I need to find a line in a file that starts with a % and then delete
> the very next line leaving the line that starts with the %. I can find
> the line by using ^% but no idea how the delete the next line.
>
> Any ideas how to do this?
>
> HNB


if there is no adjacent lines starting with '%'
then
perl -pe '<> if /^%/'
sed '/^%/N;s/\n[^\n]*$//'
awk '/^%/{print;getline;next}1'
else
redefine the rule

Xicheng

  Réponse avec citation
 
Page generated in 0,05820 seconds with 9 queries