Well dos2unix command should strip these ^M :) On Mon, Jun 24, 2002 at 05:10:15AM -0400, Abdul Latip wrote: > On Mon, 24 Jun 2002, Osamu Aoki wrote: > > > On Mon, Jun 24, 2002 at 03:57:17AM -0400, Abdul Latip wrote: > > > I am having problems with my AWK script. It used to work a > > > couple of months ago (on potato), but not anymore (on woody). > > > I have no idea why, since I seldom use it. I tried both > > > mawk and gawk. > > > > > > Apparently, $0 includes a "^M" character at the end. > > > Thus, for an empty line: /^$/ has to be changed to /^.$/ . > > > Is there any wrong environment on my system? > > > > > > Any clue? > > > > What file are you trying to read. If it is mail coming from fetchmail, > > there were some change which causes ^M in mail file. > > > > I fixed it by "with stripcr" option in /etc/fetchmailrc. > > It is ftp://ftp.isi.edu/in-notes/rfc-index.txt > I believe that that file does not have ^Ms. > Basically, what I am doing (once in a while), to get > a recent rfc-index file, and merging each rfc description > (1-3 lines) into one line. The script is actually simple > and stupid. > > regards, > > -- > Abdul Latip -- Angkasa Internet Junior Staff -- ANGIN.com > http://people.WebIndonesia.com/dullatip/ ---------------- >
Content-Description: AWK > # !/bin/sh > > awk ' > BEGIN { > STT = 0 ; > TXTTXT = ""; > } > > END { > if ( STT == 1 ) { > print TXTTXT; > LINE =0 ; > TXTTXT = ""; > } > } > > ## WAS /^$/ > /^.$/ { > if ( STT == 1 ) { > print TXTTXT; > LINE =0 ; > TXTTXT = ""; > } > next ; > } > > $1 == "0001" { > STT = 1 ; > LINE = 0 ; > } > > STT == 1 { > if ( LINE == 0 ) { > $1 = "rfc" $1 ".txt" ; > LINE = 1; > } > RS=""; > TXTTXT = TXTTXT $0; > RS="\n"; > } > > ' rfc-index.txt | sed -e "s/^M//g" -e "s/ //g" > .rfc-index.txt > > exit 0 > exit 0 > -- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Osamu Aoki <[EMAIL PROTECTED]> @ Cupertino, CA USA + -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]