07-23-2008
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 add header without creating a new file?
Thanks
Shash
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
not required this time (36 Replies)
Discussion started by: Sandeep_Malik
36 Replies
2. Shell Programming and Scripting
Hi Friends,
I want to know the command to add a new file in a existing tar file.
For Ex:
I have a tar file file1.tar with the contents
one.txt
two.txt
three.txt
Now I need to add file four.txt to this existing tar file, how can I do it?
Thanks in advance (4 Replies)
Discussion started by: mr_manii
4 Replies
3. UNIX for Dummies Questions & Answers
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
4. Shell Programming and Scripting
Hi All ,
Kindly help me with this soln
awk '{printf "%s %7s \n", $1,$c}' infile
where
value of variable c I am externally giving input
But executing the above command shows all the columns of infile where as I want only 1st column of infile and 2nd column should print value c (8 Replies)
Discussion started by: Pratik4891
8 Replies
5. Shell Programming and Scripting
I have a file with 50,000 records in it, i have a requirement to use the same 50,000 records and add them 4 times to the same file to make a total of 200,000 records. I was wondering how to do this using ksh. Any help is greatly appreciated. (2 Replies)
Discussion started by: vpv0002
2 Replies
6. Shell Programming and Scripting
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
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
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. Shell Programming and Scripting
Hi All ,
I have a pipe dilimited file .Sample file is below.I need to add header in that file through unix.
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| | ... (4 Replies)
Discussion started by: STCET22
4 Replies
10. Shell Programming and Scripting
Hello
I am facing a very unique problem and not able to understand why. I have written a function which will check header of the file. If header is present good else it will write the header on top
def writeHeaderOutputCSV(fileName):
# See if the file exist already
try:
... (0 Replies)
Discussion started by: radioactive9
0 Replies
LEARN ABOUT DEBIAN
courriel::header
Courriel::Header(3pm) User Contributed Perl Documentation Courriel::Header(3pm)
NAME
Courriel::Header - A single header's name and value
VERSION
version 0.29
SYNOPSIS
my $subject = $headers->get('subject');
print $subject->value();
DESCRIPTION
This class represents a single header, which consists of a name and value.
API
This class supports the following methods:
Courriel::Header->new( ... )
This method requires two attributes, "name" and "value". Both must be strings. The "name" cannot be empty, but the "value" can.
$header->name()
The header name as passed to the constructor.
$header->value()
The header value as passed to the constructor.
$header->as_string( charset => $charset )
Returns the header name and value with any necessary MIME encoding and folding.
The "charset" parameter specifies what character set to use for MIME-encoding non-ASCII values. This defaults to "utf8". The charset name
must be one recognized by the Encode module.
$header->stream_to( output => $output, charset => ... )
This method will send the stringified header to the specified output. The output can be a subroutine reference, a filehandle, or an object
with a "print()" method. The output may be sent as a single string, as a list of strings, or via multiple calls to the output.
See the "as_string()" method for documentation on the "charset" parameter.
ROLES
This class does the "Courriel::Role::Streams" role.
AUTHOR
Dave Rolsky <autarch@urth.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2012 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
perl v5.14.2 2012-03-07 Courriel::Header(3pm)