Mailing List Archive


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

[no subject]



>I have a file that contains lines like this:

>1 some
>text with
>C/R's
>in annoying places
>2 more text
>with CRs
>3 text text text
>4 text text

>I'd like to concat the lines that don't have leading numbers in to one long line

Use gawk or mawk, because awk have some limitations: 

 ------------->8----------------- 

gawk -F" " 'BEGIN { numexp = "[[:digit:]]+"; tmp="" }
NR > 0 {
 if ($1 ~ numexp && tmp != "") { print tmp; tmp="" }
}
{ tmp = tmp" "$0; }' 

 ------------->8----------------- 

 --
ISBN: 0060256575       OpenPGP: 0xBE40FF3E 


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links