Sponsored Content
Top Forums Shell Programming and Scripting Prepend content of a file to another file Post 302240768 by Franklin52 on Friday 26th of September 2008 01:33:34 PM
Old 09-26-2008
To prepend f2 with the contents of f1 you can simply do something like:

Code:
cat f1 f2 > f2.tmp && mv f2.tmp f2

Regards
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

prepend columns to a file

I have two files. File 'a' has contents: 1|1 2|2 3|3 4|4 and file 'b' has contents: abc|def hij|klm nop|qrs tuv|wxy I would like to prepend file 'a' to file 'b' (with pipe) such that the contents of 'b' will be: 1|1|abc|def 2|2|hij|klm 3|3|nop|qrs 4|4|tuv|wxy (3 Replies)
Discussion started by: ChicagoBlues
3 Replies

2. Shell Programming and Scripting

Append and Prepend Text to a file list

I want to print out a directory listing, then append ] to the end of each line. I'm trying to create a list of Wiki links based on folder listings that i can just copy and paste without having to edit 100's of file listings. Using sed i've figured out to do something like this: sed... (4 Replies)
Discussion started by: CapnDoody
4 Replies

3. Shell Programming and Scripting

Prepend TimeStamp to STDERR & STDOUT to a file

Currently I am redirecting STDERR and STDOUT to a log file by doing the following { My KSH script contents } 2>&1 | $DEBUGLOG Problem is the STDERR & STDOUT do not have any date/time associated. I want this to be something that i can embed into a script opposed to an argument I use... (4 Replies)
Discussion started by: nitrobass24
4 Replies

4. Shell Programming and Scripting

prepend timestamp to continiously updating log file

Hi, I have a process which outputs to a log. Below is the code snippet: process &> $LOGFILE& The log file keeps on updating whenever a transaction is processed. The log file has a time stamp added so every time I kill the process and start the process a new log file is... (4 Replies)
Discussion started by: rajkumarme_1
4 Replies

5. Shell Programming and Scripting

Sed: replace content from file with the content from file

Hi, I am having trouble while using 'sed' with reading files. Please help. I have 3 files. File A, file B and file C. I want to find content of file B in file A and replace it by content in file C. Thanks a lot!! Here is a sample of my question. e.g. (file A: a.txt; file B: b.txt; file... (3 Replies)
Discussion started by: dirkaulo
3 Replies

6. Shell Programming and Scripting

Change the file name and copy old file content to new file names.

Hi, I have a files in a directory as below :- ls -1 mqdepth-S1STC02 proc-mq-S1STC01 proc-mq-S1STC02 proc-mq-S1STC03 Whereever i have S1STC i need to copy them into new file with file name S2STC. expected output :- ls -1 mqdepth-S2STC02 proc-mq-S2STC01 proc-mq-S2STC02... (3 Replies)
Discussion started by: satishmallidi
3 Replies

7. Shell Programming and Scripting

How to remove exisiting file content from a file and have to append new file content?

hi all, i had the below script x=`cat input.txt |wc -1` awk 'NR>1 && NR<'$x' ' input.txt > output.txt by using above script i am able to remove the head and tail part from the input file and able to append the output to the output.txt but if i run it for second time the output is... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies

8. Shell Programming and Scripting

How to prepend filename to its content without a third file?

Hello, Is possibly there a way to prepend the filename to its content without a third file? The reason is to add a header to each file contents to distinguish each other when they are pasted side-by-side. sample.txt: XLOC_001 0 XLOC_002 23 XLOC_003 4 XLOC_012 6output (with the same... (4 Replies)
Discussion started by: yifangt
4 Replies

9. Shell Programming and Scripting

Gnu tool; sed awk echo etc to prepend or append string to a file

Looking to add text to a file, example File example; nodegroups: check-hosts: L@host.domain.com,host2.domain.com,host3.domain.com I need to take a file with a one line list of hosts separated by commas host.domain.com,host2.domain.com,host3.domain.comand prepend the string " ... (6 Replies)
Discussion started by: bash_in_my_head
6 Replies
Dist::Zilla::Plugin::Prepender(3pm)			User Contributed Perl Documentation		       Dist::Zilla::Plugin::Prepender(3pm)

NAME
Dist::Zilla::Plugin::Prepender - prepend lines at the top of your perl files VERSION
version 1.112280 SYNOPSIS
In your dist.ini: [Prepender] copyright = 0 line = use strict; line = use warnings; skip = t/data/.+.pl skip = something-else-unnecessary DESCRIPTION
This plugin will prepend the specified lines in each Perl module or program within the distribution. For scripts having a shebang line, lines will be inserted just after it. This is useful to enforce a set of pragmas to your files (since pragmas are lexical, they will be active for the whole file), or to add some copyright comments, as the fsf recommends. The module accepts the following options in its dist.ini section: o copyright - whether to insert a boilerplate copyright comment. defaults to true. o line - anything you want to add. may be specified multiple times. no default. o skip - regexp of file names to not prepend to. may be specified multiple times. no default. SEE ALSO
You can look for information on this module at: o Search CPAN http://search.cpan.org/dist/Dist-Zilla-Plugin-Prepender <http://search.cpan.org/dist/Dist-Zilla-Plugin-Prepender> o See open / report bugs http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dist-Zilla-Plugin-Prepender <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dist-Zilla-Plugin- Prepender> o Mailing-list (same as Dist::Zilla) <http://www.listbox.com/subscribe/?list_id=139292> o Git repository http://github.com/jquelin/dist-zilla-plugin-prepender <http://github.com/jquelin/dist-zilla-plugin-prepender> o AnnoCPAN: Annotated CPAN documentation http://annocpan.org/dist/Dist-Zilla-Plugin-Prepender <http://annocpan.org/dist/Dist-Zilla-Plugin-Prepender> o CPAN Ratings http://cpanratings.perl.org/d/Dist-Zilla-Plugin-Prepender <http://cpanratings.perl.org/d/Dist-Zilla-Plugin-Prepender> AUTHOR
Jerome Quelin COPYRIGHT AND LICENSE
This software is copyright (c) 2009 by Jerome Quelin. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.12.4 2011-08-27 Dist::Zilla::Plugin::Prepender(3pm)
All times are GMT -4. The time now is 07:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy