Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Getting rid of ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 19 Topic 2101 of 2297
Post > Topic >>

Getting rid of ^M?

by Grant <g_r_a_n_t_@[EMAIL PROTECTED] > Dec 17, 2007 at 02:12 AM

Hi there,

The http://www.iso.org/iso/iso3166_en_code_lists.txt
(ISO country codes
and 
names) has a trailing ^M on each line, currently filtering it like this:

FILENAME == "isocc" && FNR > 1 {        # there's a ; in the top comment
line
        split($0, k, ";")
        if (! k[2])			# skip blank line, it has a ^M
                next
        n = titlecase(k[1])
        cc = substr(k[2], 1, 2)         # lose trailing ^M
        printf "%s:%s\n", cc, n > outcntmp
}

What's a more general way to filter out trailing ^M please?

Grant.
-- 
http://bugsplatter.mine.nu/
 




 19 Posts in Topic:
Getting rid of ^M?
Grant <g_r_a_n_t_@[EMA  2007-12-17 02:12:11 
Re: Getting rid of ^M?
Hermann Peifer <peifer  2007-12-16 07:21:54 
Re: Getting rid of ^M?
Grant <g_r_a_n_t_@[EMA  2007-12-17 02:38:10 
Re: Getting rid of ^M?
Rikishi 42 <skunkworks  2007-12-16 22:10:03 
Re: Getting rid of ^M?
gazelle@[EMAIL PROTECTED]  2007-12-16 21:57:52 
Re: Getting rid of ^M?
Rikishi 42 <skunkworks  2007-12-17 00:37:20 
Re: Getting rid of ^M?
Ed Morton <morton@[EMA  2007-12-17 09:14:11 
Re: Getting rid of ^M?
gazelle@[EMAIL PROTECTED]  2007-12-17 16:29:00 
Re: Getting rid of ^M?
Ed Morton <morton@[EMA  2007-12-17 12:02:47 
Re: Getting rid of ^M?
Ed Morton <morton@[EMA  2007-12-17 12:10:20 
Re: Getting rid of ^M?
gazelle@[EMAIL PROTECTED]  2007-12-17 18:18:17 
Re: Getting rid of ^M?
pop <p_o_p@[EMAIL PROT  2007-12-17 13:51:40 
Re: Getting rid of ^M?
gazelle@[EMAIL PROTECTED]  2007-12-17 20:39:46 
Re: Getting rid of ^M?
pop <p_o_p@[EMAIL PROT  2007-12-17 20:43:20 
Re: Getting rid of ^M?
pop <p_o_p@[EMAIL PROT  2007-12-17 20:56:34 
Re: Getting rid of ^M?
Grant <g_r_a_n_t_@[EMA  2007-12-18 07:59:01 
Re: Getting rid of ^M?
Rikishi 42 <skunkworks  2007-12-17 22:13:05 
Re: Getting rid of ^M?
Ed Morton <morton@[EMA  2007-12-17 17:22:02 
Re: Getting rid of ^M?
Hermann Peifer <peifer  2007-12-18 00:27:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 20:38:46 CDT 2008.