Results 1 to 6 of 6

Thread: handling linux files

  1. #1
    Join Date
    Jan 2011
    Posts
    5

    handling linux files

    Hi, I have a linux file that has data like this..
    REQUEST_ID|text^Ctext^Ctext^C
    REQUEST_ID|text^Ctext^C
    REQUEST_ID|
    REQUEST_ID|
    REQUEST_ID|text^Ctext^Ctext^Ctext^Ctext^Ctext^C....
    Where ever I see a ^C character, I need to copy the corresponding REQUEST_ID and that part of the text to a new line. so my destination file should look like this..
    REQUEST_ID|text
    REQUEST_ID|text
    REQUEST_ID|text
    .
    .
    How should I do this? I have no idea how to do this because I have no knowledge in unix or linux so far..

  2. #2
    Join Date
    Jan 2011
    Posts
    5

    Re: handling linux files

    please some one reply to my post. I need help! quick help please... i can provide any further information required..

  3. #3
    Join Date
    Dec 2007
    Posts
    2,291

    Re: handling linux files

    I think that you could do that with python (.ini-Style config files): http://docs.python.org/library/configparser.html . You could just use sed with regexes, too (but forget the "easily" then, if you're not experienced a bit with sed ).

  4. #4
    Join Date
    Jan 2011
    Posts
    5

    Re: handling linux files

    Hi, Python??? I am very much unfamiliar...
    I have been using sed. I am not that bad actually. But I have never done regexes. Can you please help me in using sed with regexes? how can I do that using sed?

  5. #5
    Join Date
    Jan 2011
    Posts
    5

    Re: handling linux files

    Can some one help me/ How to so this using sed regexes or awk

  6. #6
    Join Date
    Jan 2011
    Posts
    1

    Re: handling linux files

    not sure about ur exact pattern. However see if the following example helps.
    I have used : as the seperator

    x="12345|abc:def:u"

    echo $x |sed -e 's/\([0-9]*|[a-z]*\):.*/\1/'

    Hope this helps.

Similar Threads

  1. Renaming files in Linux
    By Aileen_L in forum Operating Systems
    Replies: 5
    Last Post: 16-02-2010, 04:27 PM
  2. How do i extract .zip files on Linux
    By Mind It in forum Windows Software
    Replies: 3
    Last Post: 24-09-2009, 01:21 PM
  3. Need to install .msi files in Linux OS
    By Edwards in forum Operating Systems
    Replies: 3
    Last Post: 02-05-2009, 07:58 PM
  4. Replies: 5
    Last Post: 22-12-2007, 07:52 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,996,981.50282 seconds with 17 queries