Re-aligned text file into one raw


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Re-aligned text file into one raw
# 1  
Old 05-03-2017
Re-aligned text file into one raw

Hi,

Anyone can help on how to re-aligned the data into one raw;

Input Text File:
Code:
TESTA       Carbon A             China   06/28/2016    Active    Vol. 8210, No. 2048,
               New Era                                                                      02/25/2010
               (SCGC)                                                                        Federal Register
TESTB       Electric Intl                China   06/28/2016    Active        Vol. 8210, No. 2048,
               Economic &                                                                  02/25/2010
               Trading Co.                                                                  Federal Register
TESTC       Titanium             China      06/28/2016          Active        Vol. 8210, No. 2048,
               Industry Co.                                                                02/25/2010
                                                                                                Federal Register
TESTD       Habibi Shaquil (HS)     Iraq    06/28/2016    Active        Vol. 8210, No. 2048,
                                                                                                02/25/2010
                                                                                                Federal Register
TESTE       Mohammed Hezbollah (MH)    Iraq    06/28/2016    Active  Vol. 8210, No. 2048,
                                                                                                  02/25/2010
                                                                                                  Federal Register
TESTF       Revolutionary              Iran    06/28/2016    Active  Vol. 8210, No. 2048,
               Guardian Force                                                               02/25/2010
                                                               Federal Register

Desired Output:

Code:
TESTA;Carbon A New Era (SCGC);China;06/28/2016;Active;Vol. 8210, No. 2048,02/25/2010 Federal Register
TESTB;Electric Intl Economic & Trading Co.;China;06/28/2016;Active;Vol. 8210, No. 2048, 02/25/2010 Federal Register
TESTC;Titanium Industry Co.;China;06/28/2016;Active  Vol. 8210, No. 2048, 02/25/2010 Federal Register
TESTD;Habibi Shaquil (HS);Iraq;06/28/2016;Active;Vol. 8210, No. 2048, 02/25/2010 Federal Register
TESTE;Mohammed Hezbollah (MH);Iraq;06/28/2016;Active;Vol. 8210, No. 2048, 02/25/2010 Federal Register
TESTF;Revolutionary Guardian Force;Iran;06/28/2016;Active;Vol. 8210, No. 2048, 02/25/2010 Federal Register

Thanks in advanced.

Regards,
FSPalero


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 05-03-2017 at 04:29 AM.. Reason: Added CODE tags.
# 2  
Old 05-03-2017
Code:
awk '{gsub("    *|\t",";")} ; ! /^;/ && NR > 1 {print "" i} ; {printf $0} ; END {print ""}' infile


Last edited by rdrtx1; 05-03-2017 at 03:09 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

CGI script is returning raw text instead of getting processes

I am not a CGI/Unix expert. I was installing Cognos and as part of it we have the gateway which uses the cgi-bin The application was working fine untill the server is recreated with taking backup from the old server. so for testing I created a sample cgi file as test.cgi created at... (1 Reply)
Discussion started by: golden83
1 Replies

2. UNIX for Dummies Questions & Answers

Formatting data in a raw file by using another mapping file

Hi All, i have a requirement where i need to format the input RAW file ( which is CSV) by using another mapping file(also CSV file). basically i am getting feed file with dynamic headers by using mapping file (in that target field is mapped with source filed) i have to convert the raw file into... (6 Replies)
Discussion started by: ravi4informatic
6 Replies

3. Fedora

Raw File System

Hi! This is my first post!!! I'm sorry if i will have mistakes in english... feel free to correct me :) -------------------------------------------------------------------- I have a SanDisk Flash Drive 16GB. He is in RAW file system. The files in the drive doesnt importent and i just want... (0 Replies)
Discussion started by: efid845
0 Replies

4. Shell Programming and Scripting

Output columns needs to be aligned

Hi All I'm running a shell script and the output is something like: Col1 Col2 Col3 aaaa aaaaaaa aaaaa bbbbb bbbbb bbbbbb ccc cccccc ccccccc But I require the output to printed as given below: Col1 Col2 Col3 aaaa ... (4 Replies)
Discussion started by: nkamalkishore
4 Replies

5. Filesystems, Disks and Memory

Unix Raw file system

Hi, Can you please tell me on how to create a raw file system in Unix. If any documentation is there reagrding the same , please send me the link. Raw means filesystems which are not mounted. It is commonly used for Oracle data files. I would like to know more about its creation. (7 Replies)
Discussion started by: preethi mathew
7 Replies

6. AIX

df output is not aligned.

When I issue a "df" command the columns of the output are not aligned. QMN012:.../oracle> df -k Filesystem 1024-blocks Free %Used Iused %Iused Mounted on /dev/hd4 524288 439592 17% 5423 6% / /dev/M121A_HOME 3080192 2343764 24% 7263 2%... (1 Reply)
Discussion started by: marcogilbert
1 Replies

7. UNIX for Advanced & Expert Users

Raw text to IP Printer

We were printing to a serial laser printer with all the HP codes to generate a form (i.e. lines, boxes, etc.) We are switching to an IP printer and we can no longer print to the device (i.e. cp text /dev/tty11). It looks like we have to use the lp spooler now. When we do this the codes are ignored... (0 Replies)
Discussion started by: jeffbugfree
0 Replies

8. Filesystems, Disks and Memory

RAW File System

Hi Guys, I'm a windows user.......... I got a hard drive that windows recognize as a RAS FS ....and I don't know what is RAW file system ... can you help me guys ??? is there any way that I can access the data written on this drive from windows 2000 operations system ??? Thanks & Best... (1 Reply)
Discussion started by: night1901
1 Replies
Login or Register to Ask a Question