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.
output (with the same name sample.txt):
So far, I've tried:
but got error: input file is output file
I'm aware of the solution is to use a tmp file, and rename it to the original name.
I am wondering if there is a way to do this job without the "tmp" file. The closest function I can think of is to add filename to its content within vim and :wq which does not require a third file name, but I have hundreds of files to modify.
Thanks!
Last edited by yifangt; 05-10-2016 at 05:28 PM..
Reason: typo
:confused: There is a flat file on my system which contains email addreses of people in my company. This file is utilized when sending notifications for various things. However nobody knows where this file is located or what it is named. The only thing we know is the email address of a user who... (4 Replies)
Dear Experts,
Please help to teach me how to add the filename into the file content.
Actually the file name are EVENTS-20050912.
***************New output that I want***************
EVENTS-20050912 03:33:37 ALARM: BTSSPAN-277-1 30-18013
EVENTS-20050912 12:10:28 ALARM: BTSSPAN-297-2... (1 Reply)
Hi,
I have to rename all occurance of CUST_MST to RESELLER_MST both in filename and file content under a directory (say D0) which contains multiple (2-3 levels) sub directory.
Example:
D0 -> D1 -> D2 has a file CUST_MST_TEMP.txt
this contains :
> cat /D0/D1/D2/CUST_MST_TEMP.txt... (3 Replies)
How can i prepend the content of a file to another file? I tried:
sed '1r textfile' myfile
but it inserted the text AFTER the first line? What would be a good method?
I can easily append lines to a file using the ">>" operator, is the something similar in bash to prepend lines?
Kind regards... (2 Replies)
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)
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)
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)
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
LEARN ABOUT DEBIAN
pdf::api2::page
PDF::API2::Page(3pm) User Contributed Perl Documentation PDF::API2::Page(3pm)NAME
PDF::API2::Page - page management
METHODS
$page = PDF::API2::Page->new $pdf, $parent, $index
Returns a page object (called from $pdf->page).
$page = PDF::API2::Page->coerce $pdf, $pdfpage
Returns a page object converted from $pdfpage (called from $pdf->openpage).
$page->update
Marks a page to be updated (by $pdf->update).
$page->mediabox $w, $h
$page->mediabox $llx, $lly, $urx, $ury
$page->mediabox $alias
Sets the mediabox. This method supports the following aliases: '4A', '2A', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', '4B', '2B', 'B0',
'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'LETTER', 'BROADSHEET', 'LEDGER', 'TABLOID', 'LEGAL', 'EXECUTIVE', and '36X36'.
($llx, $lly, $urx, $ury) = $page->get_mediabox
Gets the mediabox based one best estimates or the default.
$page->cropbox $w, $h
$page->cropbox $llx, $lly, $urx, $ury
$page->cropbox $alias
Sets the cropbox. This method supports the same aliases as mediabox.
($llx, $lly, $urx, $ury) = $page->get_cropbox
Gets the cropbox based one best estimates or the default.
$page->bleedbox $w, $h
$page->bleedbox $llx, $lly, $urx, $ury
$page->bleedbox $alias
Sets the bleedbox. This method supports the same aliases as mediabox.
($llx, $lly, $urx, $ury) = $page->get_bleedbox
Gets the bleedbox based one best estimates or the default.
$page->trimbox $w, $h
$page->trimbox $llx, $lly, $urx, $ury
Sets the trimbox. This method supports the same aliases as mediabox.
($llx, $lly, $urx, $ury) = $page->get_trimbox
Gets the trimbox based one best estimates or the default.
$page->artbox $w, $h
$page->artbox $llx, $lly, $urx, $ury
$page->artbox $alias
Sets the artbox. This method supports the same aliases as mediabox.
($llx, $lly, $urx, $ury) = $page->get_artbox
Gets the artbox based one best estimates or the default.
$page->rotate $deg
Rotates the page by the given degrees, which must be a multiple of 90.
(This allows you to auto-rotate to landscape without changing the mediabox!)
$gfx = $page->gfx $prepend
Returns a graphics content object. If $prepend is true the content will be prepended to the page description.
$txt = $page->text $prepend
Returns a text content object. If $prepend is true the content will be prepended to the page description.
$ant = $page->annotation
Returns a new annotation object.
$page->resource $type, $key, $obj
Adds a resource to the page-inheritance tree.
Example:
$co->resource('Font',$fontkey,$fontobj);
$co->resource('XObject',$imagekey,$imageobj);
$co->resource('Shading',$shadekey,$shadeobj);
$co->resource('ColorSpace',$spacekey,$speceobj);
Note: You only have to add the required resources, if they are NOT handled by the *font*, *image*, *shade* or *space* methods.
AUTHOR
Alfred Reibenschuh
perl v5.14.2 2014-03-09 PDF::API2::Page(3pm)