Sponsored Content
Top Forums Shell Programming and Scripting How to prepend filename to its content without a third file? Post 302972777 by yifangt on Tuesday 10th of May 2016 06:34:47 PM
Old 05-10-2016
Thanks xbin!
This worked out to be exactly what I was looking for.
Could you please elaborate the first part of the pipe?
Code:
printf "%s\n" 1i "geneID  $file" . w

I wish vim could be piped to the command line, and I am not familiar with ed at all.
Thanks again!

Last edited by yifangt; 05-10-2016 at 08:28 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find filename based on file content

: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)
Discussion started by: kollerj
4 Replies

2. Shell Programming and Scripting

Adding filename into file content

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)
Discussion started by: missutoomuch
1 Replies

3. Shell Programming and Scripting

find and replace in subdirectory (filename & content - both)

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)
Discussion started by: sabyasm
3 Replies

4. Shell Programming and Scripting

Prepend content of a file to another file

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)
Discussion started by: Christoph Spohr
2 Replies

5. 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

6. 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

7. Shell Programming and Scripting

Search for string in filename, not file content

How can I search for a string in a filename? For example, I want to know if a filename (not the file contents) contains the string "test". (3 Replies)
Discussion started by: daflore
3 Replies

8. 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

9. 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
cuebreakpoints(1)					      General Commands Manual						 cuebreakpoints(1)

NAME
cuebreakpoints - report track breakpoints from a CUE or TOC file SYNOPSIS
cuebreakpoints [ { -i format | --input-format=format } { --append-gaps | --prepend-gaps | --split-gaps } ] [ file ... ] cuebreakpoints --help DESCRIPTION
cuebreakpoints reports the track breakpoints found in CUE and TOC files, which are typically created by compact disc ripping software. The breakpoints are in a format usable by shnsplit (part of the shntool package). Three approaches to track pregaps are availabe: append (to previous track), prepend (to succeeding track), and split (from both preceding and succeeding tracks). The split approach can result in up to twice as many breakpoints being reported as there are tracks on the disc. The first track's pregap cannot be appended to the previous track, so it is prefixed to the track in both append and prepend modes. If you want the track without it, use the --split-gaps option. If no filenames are specified, cuebreakpoints reads from standard input, and an input format option must be specified. If one or more filenames is provided, but the input format option is not specified, the input format will be guessed based on each file's suffix (e.g., .cue or .toc). This heuristic is case-insensitive. OPTIONS
-h, --help displays a usage message and exits. -i format, --input-format=format sets the expected format of the input file(s) to format, which must be either cue or toc. --append-gaps appends pregaps to the end of the previous track. This is the default. --prepend-gaps prefixes pregaps to the beginning of each subsequent track. --split-gaps separates pregaps from both the preceding and succeeding tracks. If more than one of --append-gaps, --prepend-gaps, and --split-gaps are specified, all except the last encountered are ignored. EXIT STATUS
cuebreakpoints exits with status zero if it successfully generates a report for each input file, and nonzero if there were problems. AUTHOR
Cuetools was written by Svend Sorensen. Branden Robinson contributed fixes and enhancements to the utilities and documentation. SEE ALSO
cueconvert(1), cueprint(1) cuebreakpoints(1)
All times are GMT -4. The time now is 06:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy