Sponsored Content
Top Forums Shell Programming and Scripting Append variable texts to the beginning of each line in all files in a directory Post 302607628 by balajesuri on Thursday 15th of March 2012 02:00:59 AM
Old 03-15-2012
Is it the filename (without its extension) that you want to put in front of each line? If so, then try this:

Code:
for file in *.sco; do sed -i "s/^/$(basename $file .sco) /g" $file; done

This User Gave Thanks to balajesuri For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

input a line at the beginning of every file in a directory?

if need to input a word or anything at the beginning of every file in a directory. how do i accomplish this? say the file is named hyperten. how do i make hyperten the first line of every file in a given directory? thanks (6 Replies)
Discussion started by: Terrible
6 Replies

2. Shell Programming and Scripting

search directory-find files-append at end of line

Hi, I have a command "get_data" with some parameters in few *.text files of a directory. I want to first find those files that contain this command and then append the following parameter to the end of the command. example of an entry in the file :- get_data -x -m50 /etc/web/getid this... (1 Reply)
Discussion started by: PrasannaKS
1 Replies

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

4. Shell Programming and Scripting

Append file name to the beginning of each line

I want to append file names at the beginning of a line for each row file content abc.txt.gz 123|654|987 bcd.txt.gz 876|trf|kjh I want a single output file with below format abc.txt.gz|123|654|987 bcd.txt.gz|876|trf|kjh This one is working but only with unzip files,need to have... (3 Replies)
Discussion started by: rakesh5300
3 Replies

5. UNIX for Dummies Questions & Answers

sed - Add a variable line to the end of a block beginning with a regex

Hi, Need some help with sed. I have a file that has sections : e.g. a=blah b=blah d=blah e=blah There's many sections in the file. (1 Reply)
Discussion started by: andyatit
1 Replies

6. Shell Programming and Scripting

Append Multiple files with file name in the beginning of line

Hi, I have multiple files having many lines like as bvelow: file Name a.txt abc def def xyz 123 5678 file Name b.txt abc def def xyz 123 5678 I would like to append files in the below format to a new file: file Name c.txt (7 Replies)
Discussion started by: rramkrishnas
7 Replies

7. Shell Programming and Scripting

How to pre-append a variable string to each line in a file?

How to pre-append a variable string to each line in a file contains both single and double quotes? The variable string has no quotes in it. thank you very much. :confused: (8 Replies)
Discussion started by: dtdt
8 Replies

8. Shell Programming and Scripting

How to Append data to the content at the beginning of a variable?

Hi Guys, IF i have to append data to a variable, i simply use the following. What can i do to append data to the beginning? VAR+="data" (6 Replies)
Discussion started by: srkmish
6 Replies

9. Shell Programming and Scripting

How to append in the beginning not at the end?

Hi, I now that >> will append text to the end of the text that is already inside the file. How to append the new text infront of the text that is already in the file. Thanks for any input. Regards, Chandu (3 Replies)
Discussion started by: chandrakanth
3 Replies

10. Shell Programming and Scripting

Append string to all the files inside a directory excluding subdirectories and .zip files

Hii, Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories. Eg. file1: test1.log file2: test2.log file3 test.zip After running the script file1: string_test1.log file2: string_test2.log file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies
CS(1)							  The Canonical Csound Reference						     CS(1)

NAME
cs - Starts Csound with a set of options that can be controlled by environment variables, and input and output files determined by the specified filename stem. . DESCRIPTION
Starts Csound with a set of options that can be controlled by environment variables, and input and output files determined by the specified filename stem. SYNTAX
cs [-OPTIONS] <name> [CSOUND OPTIONS ... ] INITIALIZATION
Flags: o - OPTIONS = OPTIONS is a sequence of alphabetic characters that can be used for selecting the Csound executable to be run, as well as the command line flags (see below). There is a default for the option 'r' (selects real-time output), but it can be overridden. o <name> = this is the filename stem for selecting input files; it may contain a path. Files that have .csd, .orc, or .sco extension are searched, and either a CSD or an orc/sco pair that matches <name> the best are selected. MIDI files with a .mid extension are also searched, and if one that matches <name> at least as close as the CSD or orc/sco pair, it is used with the -F flag. NOTE The MIDI file is not used if any -M or -F flag is specified by the user - new in version 4.24.0) Unless there is any option (-n or -o) related to audio output, an output file name with the appropriate extension is automatically generated (based on the name of selected input files and format options). The output file is always written to the current directory. NOTE file name extensions are not case sensitive. o [CSOUND OPTIONS ... ] = any number of additional options for Csound that are simply copied to the final command line to be executed. The command line that is executed is generated from four parts: 1. Csound executable (possibly with options). This is exactly one of the following (the last one has the highest precedence): o a built-in default o the value of the CSOUND environment variable o environment variables with a name in the format of CSOUND_x where x is an uppercase letter selected by characters of the -OPTIONS string. Thus, if the -dcba option is used, and the environment variables CSOUND_B and CSOUND_C are defined, the value of CSOUND_B will take effect. 2. Any number of option lists, added in the following order: o either some built-in defaults, or the value of the CSFLAGS environment variable if it is defined. o environment variables with a name in the format of CSFLAGS_x where x is an uppercase letter selected by characters of the -OPTIONS string. Thus, if the -dcba option is used, and the environment variables CSFLAGS_A and CSFLAGS_C are defined as '-M 1 -o dac' and '-m231 -H0', respectively, the string '-m231 -H0 -M 1 -o dac' will be added. 3. The explicit options of [CSOUND OPTIONS ... ]. 4. Any options and file names generated from <name>. NOTE Quoted options that contain spaces are allowed. EXAMPLES
Assuming the following environment variables: CSOUND = csoundfltk.exe -W CSOUND_D = csound64.exe -J CSOUND_R = csoundfltk.exe -h CSFLAGS = -d -m135 -H1 -s CSFLAGS_D = -f CSFLAGS_R = -m0 -H0 -o dac1 -M "MIDI Yoke NT: 1" -b 200 -B 6000 And a directory that contains: foo.orc piano.csd foo.sco piano.mid im.csd piano2.mid ImproSculpt2_share.csd foobar.csd The following commands will execute as shown: cs foo => csoundfltk.exe -W -d -m135 -H1 -s -o foo.wav foo.orc foo.sco cs foob => csoundfltk.exe -W -d -m135 -H1 -s -o foobar.wav foobar.csd cs -r imp -i adc => csoundfltk.exe -h -d -m135 -H1 -s -m0 -H0 -o dac1 -M "MIDI Yoke NT: 1" -b 200 -B 6000 -i adc ImproSculpt2_share.csd cs -d im => csound64.exe -J -d -m135 -H1 -s -f -o im.sf im.csd cs piano => csoundfltk.exe -W -d -m135 -H1 -s -F piano.mid -o piano.wav piano.csd cs piano2 => csoundfltk.exe -W -d -m135 -H1 -s -F piano2.mid -o piano2.wav piano.csd CREDITS
Author: Istvan Varga Jan 2003 AUTHORS
Barry Vercoe MIT Media Lab Author. Dan Ellis MIT Media Lab, Cambridge Massachussetts Author. COPYRIGHT
5.10 08/01/2011 CS(1)
All times are GMT -4. The time now is 04:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy