Sponsored Content
Top Forums Shell Programming and Scripting Add text to beginning of file Post 302133602 by zazzybob on Friday 24th of August 2007 06:37:13 AM
Old 08-24-2007
Something like this
Code:
$ ls /usr/home/*/*.bat | while read file; do 
>   ( echo "add this"; cat ${file} ) > ${file}.new && mv ${file}.new ${file}
> done

Cheers,
ZB
 

10 More Discussions You Might Find Interesting

1. Linux

Add file's date at beginning of every line in file

How would I do that? /Rutger (6 Replies)
Discussion started by: rutgerblom
6 Replies

2. UNIX for Dummies Questions & Answers

Count Number Of lines in text files and append values to beginning of file

Hello, I have 50 text files in a directory called "AllFiles" I want to make a program that will go inside of the "AllFiles" Directory and count the number of lines in each individual text file. Then, the program will calculate how many more lines there are over 400 in each text file and... (7 Replies)
Discussion started by: motoxeryz125
7 Replies

3. Shell Programming and Scripting

Need to insert text(constant) at the beginning of file

I am very new to scripting and I know this request is simple but I am having no luck with it. I have a file a.dat with the following data in it. aa bb cc dd I need to run a script that will take each line of a.dat and put dsjc/ubin/ in front of each record, so the output looks like ... (2 Replies)
Discussion started by: jclanc8
2 Replies

4. Shell Programming and Scripting

trying to add text to beginning and end of each line

Well here goes: I tried to write a batch file that adds a specific fixed text to each line of an already existing text file. for the adding text infront of each line I tried this: for /F "delims=" %%j in (list.txt) do echo.STARTTEXT\%%j >> list.txt for adding text after each line I... (0 Replies)
Discussion started by: pasc
0 Replies

5. Windows & DOS: Issues & Discussions

Trying to add text to the beginning of each line

Well here goes: I tried to write a batch file that adds a specific fixed text to each line of an already existing text file. for the adding text infront of each line I tried this: for /F "delims=" %%j in (list.txt) do echo.STARTTEXT\%%j >> list.txt for adding text after each line I... (6 Replies)
Discussion started by: pasc
6 Replies

6. UNIX for Dummies Questions & Answers

Add word/value at the beginning of each line in a file

how to add value/word at the beginning of each line in a file ? i have file number.txt and the output is below 1000 1001 1002 1003 1004 i want to add 000 at the beginning of each line, desire output is below 0001000 0001001 0001002 0001003 0001004 and so on please advise how... (5 Replies)
Discussion started by: jason6247
5 Replies

7. Shell Programming and Scripting

How to add a text at the beginning of a text files in a folder?

how to add a text ( surya) at the beginning of a text files (so many) in folder text file: 111111 555555 666666 result: surya 111111 555555 666666 (3 Replies)
Discussion started by: suryanarayana
3 Replies

8. Shell Programming and Scripting

Add new line at beginning and end of a file

Hi, I have a specific requirement to add text at the beginning and end of a plain text file. I tried to use "sed" with '1i' and '$a' flags but these required two separate "sed" commands separated with "|". I am looking for some command/option to join these two in single command parameter. ... (6 Replies)
Discussion started by: bhupinder08
6 Replies

9. Shell Programming and Scripting

How to add one line in the beginning of the file?

Hi gurus, I need add one new line in the begining of current file. current file abc cde add xyz output file newline abc cde add xyz (6 Replies)
Discussion started by: ken6503
6 Replies

10. Shell Programming and Scripting

Add words in beginning , end after removing a word in a file

My file has the entries like below... /dev/sds /dev/sdak /dev/sdbc /dev/sdbu I want to make the file like below echo 1 > /sys/block/sds/device/rescan echo 1 > /sys/block/sdak/device/rescan echo 1 > /sys/block/sdbc/device/rescan echo 1 > /sys/block/sdbu/device/rescan (2 Replies)
Discussion started by: saravanapandi
2 Replies
gnomevfs-cat(1) 						   User Commands						   gnomevfs-cat(1)

NAME
gnomevfs-cat - print a file to standard output using the VFS system SYNOPSIS
gnomevfs-cat URI DESCRIPTION
gnomevfs-cat is obsolete. It has been superseded by gvfs-cat. See gvfs-cat(1). gnomevfs-cat prints a file to standard output using the virtual file system to access the file via a URI. OPERANDS
The following operands are supported: URI Specifies the file location in standard URI format. EXAMPLES
Example 1: Cat a File From a Web Server example% gnomevfs-cat http://www.sun.com Example 2: Cat a Local File example% gnomevfs-cat file:///home/user/README.txt ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: NLSPATH. EXIT STATUS
The exit value 0 is returned regardless of success or failure. FILES
The following files are used by this application: /usr/bin/gnomevfs-cat Executable to print a file to standard output using the VFS system ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-vfs | +-----------------------------+-----------------------------+ |Interface stability |Obsolete Volatile | +-----------------------------+-----------------------------+ SEE ALSO
gnomevfs-copy(1), gnomevfs-info(1), gnomevfs-ls(1), gnomevfs-mkdir(1), gvfs-cat(1), attributes(5), environ(5) NOTES
Written by Stephen Browne, Sun Microsystems Inc., 2004. SunOS 5.11 14 May 2008 gnomevfs-cat(1)
All times are GMT -4. The time now is 04:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy