Adding fields to file | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Adding fields to file

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-18-2012
Arun Mishra Arun Mishra is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 11 June 2014, 4:30 AM EDT
Posts: 51
Thanks: 4
Thanked 0 Times in 0 Posts
Adding fields to file

Hi All,

I have a file(Pipe Delimited) where i need to add a blank field before the last field and a blank field after the last field. Please help. I have provided below the sample input records and desired output.


Code:
Sample Input: A0010000|Abilene TX A 1|A0010957|Dallas TX|A0010998|West|US HEADQUARTERS A0010001|Akron OH A 1|A0010954|Cleveland OH|A0010997|Central|US HEADQUARTERS A0010002|Alaska AK A 1|A0010991|Seattle WA|A0010998|West|US HEADQUARTERS Sample Output Required: A0010000|Abilene TX A 1|A0010957|Dallas TX|A0010998|West||US HEADQUARTERS| A0010001|Akron OH A 1|A0010954|Cleveland OH|A0010997|Central||US HEADQUARTERS| A0010002|Alaska AK A 1|A0010991|Seattle WA|A0010998|West||US HEADQUARTERS|

Last edited by Scott; 12-18-2012 at 05:37 AM.. Reason: Double post. Closed.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding Fields to the file Arun Mishra Shell Programming and Scripting 25 12-20-2012 07:00 AM
regarding adding fields to DSR protocol in ns2.34 khubalkar Homework & Coursework Questions 2 05-25-2012 03:52 AM
regarding adding fields to DSR protocol in ns2.34 khubalkar Programming 1 05-22-2012 06:05 PM
Adding field to file and moving the last 2 fields dsravan Shell Programming and Scripting 8 01-27-2010 12:13 AM
Adding new fields to an existing layout mr_manii Shell Programming and Scripting 3 10-14-2009 07:22 AM



All times are GMT -4. The time now is 09:05 PM.