Thread: awk again

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    79

    awk again

    I have a list of records like below:

    N_p_hello[f]_lolo where p and f is a number from 0 to 1000 and i would like to substitute the hello[f] with the number f so it will be
    N_p_f_lolo

    I tried some staff but i cant find a way

  2. #2
    Registered User
    Join Date
    Apr 2010
    Posts
    79
    my question could be is there any way of saying any character in awk like the "*" operator
    As far as i understand there is the "." operator which means any but only one character.
    for example A.U means any string that has three characters and begins with A and ends with U.

    But if we dont know how many characters we have within?

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    I don't use awk, I use python, so there will be differences.

    \d pulls out a single digit (0-9) and you can follow it with {x,y} where x is the least amount of digits and y is the max

    Syntax might be different for you though

  4. #4
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Why don't you post what you'ave tried.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. awk question
    By Chris_1980 in forum Linux Programming
    Replies: 2
    Last Post: 10-06-2010, 10:26 AM
  2. awk -- escaping the delimiter
    By Kennedy in forum Linux Programming
    Replies: 7
    Last Post: 06-07-2010, 12:14 AM
  3. awk on non stop stream
    By TuXaKoS in forum Linux Programming
    Replies: 16
    Last Post: 04-28-2010, 03:56 PM
  4. where to download grep, sed, awk for Windows?
    By Amy N. in forum C Programming
    Replies: 2
    Last Post: 08-01-2009, 12:39 AM
  5. mistake of using awk
    By lehe in forum Linux Programming
    Replies: 6
    Last Post: 04-02-2009, 04:41 PM