Sponsored Content
Top Forums Shell Programming and Scripting Need help in adding header of a file Post 302955007 by RavinderSingh13 on Monday 14th of September 2015 06:19:38 AM
Old 09-14-2015
Quote:
Originally Posted by STCET22
Hi All ,
I have a pipe dilimited file .Sample file is below.I need to add header in that file through unix.
HTML Code:
000001|     1|AQWWW|234,456.00  |     | 123456|     |41|abC| 0|xyZ|
000002|     2|11  4|1,234,456.99|     |      0|     |23|   |99|!  |   
000003|     3|!!@#$|0,000,001.10|     |      9|     | 0|XSW|12|  7|    
000004|     4|     |            |     |   3400|     | 2|r7!|72|xY1| 
We need to add header like below .
col1|col2|col3|col4|col5|col6|col7|col8|col9|col10|col11|col12|col13|col14|col15|col16|col17|col18|c ol19|col20|col21|col22|col23|col24|col25|col26

If anyone can help me in this regard ,this will be highly beneficial for me.Thanks .
Hello STCET22,

Following may help you in same.
Code:
awk 'BEGIN{OFS="|";for(i=1;i<=26;i++){O=O?O OFS "col"i:"col"i};print O;O=""}1'  Input_file

Output will be as follows.
Code:
col1|col2|col3|col4|col5|col6|col7|col8|col9|col10|col11|col12|col13|col14|col15|col16|col17|col18|col19|col20|col21|col22|col23|col24|col25|col26
000001|     1|AQWWW|234,456.00  |     | 123456|     |41|abC| 0|xyZ|
000002|     2|11  4|1,234,456.99|     |      0|     |23|   |99|!  |
000003|     3|!!@#$|0,000,001.10|     |      9|     | 0|XSW|12|  7|
000004|     4|     |            |     |   3400|     | 2|r7!|72|xY1|

Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Adding header to an existing file

Dear All, I need to add a header of one line to an already existing file. I know that it can be achieved by the following: echo "Header" > newfile cat file1 >> newfile But my problem is that file is huge and there is no space for creating a new file every time. Is there a way that I can... (5 Replies)
Discussion started by: shash
5 Replies

2. UNIX for Dummies Questions & Answers

Adding a header to a log file

Hello, I’m trying to add a row that will server as the header for a space separated file. 1-I have a number of files save in a directory 2- grep text path/*.log > newfile newfile looks like this Field1 Field2 Field3 Field4 Field1 Field2 Field3 Field4 Field1 Field2 Field3 Field4 Field1... (2 Replies)
Discussion started by: rene reivera jr
2 Replies

3. Shell Programming and Scripting

Adding header once every 5 lines

Hi, I need a help in creating a report file. The input file is like this 1 A 2 B 3 V 4 X 5 m 6 O 7 X 8 p 9 a 10 X There is a header which i have to print & save the result as a output file. The header has multiple lines on is like say: New New S.No Name (15 Replies)
Discussion started by: aravindan
15 Replies

4. Shell Programming and Scripting

Rename a header column by adding another column entry to the header column name URGENT!!

Hi All, I have a file example.csv which looks like this GrpID,TargetID,Signal,Avg_Num CSCH74_1_1,2007,61,256 CSCH74_1_1,212007,647,679 CSCH74_1_1,12007,3,32 CSCH74_1_1,207,299,777 I want the output as GrpID,TragetID,Signal-CSCH74_1_1,Avg_Num CSCH74_1_1,2007,61,256... (4 Replies)
Discussion started by: Vavad
4 Replies

5. UNIX for Dummies Questions & Answers

Rename a header column by adding another column entry to the header column name

Hi All, I have a file example.csv which looks like this GrpID,TargetID,Signal,Avg_Num CSCH74_1_1,2007,61,256 CSCH74_1_1,212007,647,679 CSCH74_1_1,12007,3,32 CSCH74_1_1,207,299,777 I want the output as GrpID,TragetID,Signal-CSCH74_1_1,Avg_Num CSCH74_1_1,2007,61,256... (1 Reply)
Discussion started by: Vavad
1 Replies

6. Shell Programming and Scripting

Adding Header and Trailer records to a appended file

How can we a shell script and pass date parameters .I have 3 files comming from Datastage with |" delimited I need append 3 files as above: File1: P0000|"47416954|"AU|"000|"INS|"0000|"|"20060601|"99991231|"|"|"|"|"01 File 2:... (2 Replies)
Discussion started by: e1994264
2 Replies

7. UNIX for Dummies Questions & Answers

Adding header and trailer into a file

Hi, I want to add the below Header to all the files in sequence File1,File2,File3...etc "ABC,<number of chracter in the file>" e,g - If File1 is as below pqrstuvdt abcdefgh then I want to add the above header into it ,So that File1 becomes as below ABC,17 pqrstuvdt abcdefgh ... (9 Replies)
Discussion started by: spari2
9 Replies

8. Shell Programming and Scripting

adding header in a file

Hi team, In my script i am storing some value in a variable "header". I want to add the header value has header in a file. Please help me on this Thanks in advance, Baski (4 Replies)
Discussion started by: baskivs
4 Replies

9. UNIX for Dummies Questions & Answers

oneliner for adding header and trailer

for example, i have a file with below content: 123413 866688 816866 818818 i want the output as: This is header 123413 866688 816866 818818 This is trailer i am able to achieve it using a bash script. (2 Replies)
Discussion started by: pandeesh
2 Replies

10. Shell Programming and Scripting

Adding header to sub files after splitting the main file using AWK

Hi Folks, I have a file like: mainfile.txt: ------------- file1 abc def xyz file1 aaa pqr xyz file2 lmn ghi xyz file2 bbb tuv xyz I need output having two files file1 and file2. file1: ------ Name State Country abc def xyz aaa pqr xyz file2: (3 Replies)
Discussion started by: tanmay.gemini
3 Replies
XSYSTEM35(6)						       xsystem35 User Manual						      XSYSTEM35(6)

NAME
xsystem35 - program to play System 3.5 games SYNOPSIS
xsystem35 [OPTIONS] DESCRIPTION
This manual page documents briefly the xsystem35 command. This manual page was written for the Debian distribution because the original program does not have a manual page. xsystem35 is a program to run System 3.5 games. Known games are: o Kichikuou Rance o Ikenai Katsumi Sensei o Rance IV for WIN o Tshin Toshi 2 for WIN o Kaerunyo Panyon o Ikusamiko o Ningengari (in Alice no Yakata 456) o Type Zero (in Alice no Yakata 456) o ATLACH=NACHA (in Alice no Yakata 456) o DALK (in Alice no Yakata 456) o Tshin Toshi (in Alice no Yakata 456) o Dr. Stop! (in Alice no Yakata 456) o Rance I (in Alice no Yakata 456) o Rance II (in Alice no Yakata 456) o Rance III (in Alice no Yakata 456) o o DiaboLiQuE o AmbivalenZ for Win95 o Pastel Chime o Prostudent GOOD o Mamorigami-sama o Mamatoto o Hushaby Baby o DARCROWS o Persiom o o SeeIN Ao o D.P.S.? (in 20 seiki Alice) o (in 20 seiki Alice) o Only You - Re cross o Lv1.5 o Daiakuji (Not opening) o (Not opening) OPTIONS
The program start with the following options starting with one dash (`-'). A summary of options is included below. -gamefile file set game resouce file to 'file' -no-shm don't use MIT-SHM (use in another display) -devcd device set cdrom device name to 'device' -devmidi device set midi device name to 'device' -devdsp device set audio device name to 'device' /dev/dsp : oss type (device name) -O? select output audio device -Oo OSS mode -Os ALSA mode -Oe Enlightened Sound Daemon mode -O0 Disable Audio output -M? select output midi methods -Me External midi player -Mr Raw Midi device -Ms? Sequenceer device (?:devicenumber) -M0 Disable MIDI output -midiplayer cmd set external midi player to 'cmd' -devmix device set mixer device name to 'device' (effective only for oss) -devjoy device set joystick device name to 'device' if 'device' is set to 'none', don't use the device -savekanji # kanji code of filename (0 or 1 ... 0:euc, 1:sjis) -antialias always draw antialiased string (for !256 colors game) -noantialias never use antialiased string (for !256 colors game) -fullscreen start with fullscreen -noimagecursor disable image cursor -version Show version of program. -h, --help Show summary of options. FILES
${HOME}/.xsys35rc The per-user configuration file to control the behaviour of xsystem35. AUTHOR
Ying-Chun Liu <paulliu@debian.org> Wrote this manpage for the Debian system. COPYRIGHT
Copyright (C) 2010 Ying-Chun Liu (PaulLiu) This manual page was written for the Debian system (and may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or (at your option) any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2. xsystem35 11/20/2011 XSYSTEM35(6)
All times are GMT -4. The time now is 09:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy