INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Modifiying a Column/Record while keeping format

Modifiying a Column/Record while keeping format

(OP)
Hi Guys, I have a problem which I know I can Fix with awk, sed or PERL, but I'm just a beginner using those tools.

Here is it.

I have a large file like this:
__576429.250_2161394.750____2708.832_24_1_1DepthTDQ2012MIOZaap24iLimSSEIMP____________LGC
__577503.500_2162441.750____3952.155_24_1_2DepthTDQ2012MIOZaap24iLimSSEIMP____________LGC
__577722.812_2162655.500____4346.954_24_1_2DepthTDQ2012MIOZaap24iLimSSEIMP____________LGC
__577973.500_2162899.750____4801.474_24_1_2DepthTDQ2012MIOZaap24iLimSSEIMP____________LGC
__578092.062_2163015.250____5021.743_24_1_3DepthTDQ2012MIOZaap24iLimSSEIMP____________LGC
__575034.125_2165620.500____2556.695_24_1_1DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574559.688_2165158.250____3204.005_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574241.875_2164848.500____3787.890_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574183.625_2164791.750____3882.056_24_1_3DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__575112.375_2165522.250____2550.740_24_1_1DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574624.438_2165046.750____3295.139_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574472.312_2164898.500____3587.907_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574293.250_2164724.000____3907.159_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574132.125_2164567.000____4077.007_24_1_3DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__575266.750_2165498.250____2548.748_24_1_1DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__575119.062_2165354.250____2753.772_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574501.375_2164752.250____3764.174_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574286.562_2164543.000____4044.122_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574111.938_2164372.750____4287.866_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC
__574013.438_2164276.750____4416.478_24_1_3DepthTDQ2012MIOZaap23iLimNSWIMP___________LGC

NOTE: Underscores ( _ ) are actually blanks (whithespaces).

I need to append a _v1 to the fifth column while preserving the number at the beginning of the record and, (very important) maintaining the format/spaces between records/columns.

Desired Output:

__576429.250_2161394.750____2708.832_24_1_1DepthTDQ2012MIOZaap24iLimSSEIMP.v1_________LGC
__577503.500_2162441.750____3952.155_24_1_2DepthTDQ2012MIOZaap24iLimSSEIMP.v1_________LGC
__577722.812_2162655.500____4346.954_24_1_2DepthTDQ2012MIOZaap24iLimSSEIMP.v1_________LGC
__577973.500_2162899.750____4801.474_24_1_2DepthTDQ2012MIOZaap24iLimSSEIMP.v1_________LGC
__578092.062_2163015.250____5021.743_24_1_3DepthTDQ2012MIOZaap24iLimSSEIMP.v1_________LGC
__575034.125_2165620.500____2556.695_24_1_1DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574559.688_2165158.250____3204.005_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574241.875_2164848.500____3787.890_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574183.625_2164791.750____3882.056_24_1_3DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__575112.375_2165522.250____2550.740_24_1_1DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574624.438_2165046.750____3295.139_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574472.312_2164898.500____3587.907_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574293.250_2164724.000____3907.159_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574132.125_2164567.000____4077.007_24_1_3DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__575266.750_2165498.250____2548.748_24_1_1DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__575119.062_2165354.250____2753.772_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574501.375_2164752.250____3764.174_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574286.562_2164543.000____4044.122_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574111.938_2164372.750____4287.866_24_1_2DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC
__574013.438_2164276.750____4416.478_24_1_3DepthTDQ2012MIOZaap23iLimNSWIMP.v1________LGC


NOTE: Underscores ( _ ) are actually blanks (whithespaces).

I know I can do it with awk using sub and split but I'm suffering here.

Thanks in advance

RE: Modifiying a Column/Record while keeping format

(OP)
Sorry guys, actually it is the Sixth column.

RE: Modifiying a Column/Record while keeping format

(OP)
Thanks a lot PHV. Gonna work on that

RE: Modifiying a Column/Record while keeping format

(OP)
It works.

Great!!!.


AWK is powerful and useful ( once you get to know how it works ).


Thanks againg PHV.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close