Sponsored Content
Full Discussion: Adding Strings to a file
Top Forums Shell Programming and Scripting Adding Strings to a file Post 302355494 by daPeach on Tuesday 22nd of September 2009 09:42:45 PM
Old 09-22-2009
uuoc !
Code:
cp myfile myfile.bak
while read line
do
   echo "word1 $line" >> myfile
done < myfile.bak

or use sed
Code:
sed -i 's/^/word1 /' myfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash hell , removing " and adding from a strings

I'm writing a bash script and i'm stuck the out put of a dialog menu is echo $select "foo" "bar" "lemon" cheese" while I need $foo $bar $lemon $cheese to reuse them as strings later in the script and very new to bash scripting and i've no idea how to do this any help would be... (2 Replies)
Discussion started by: xpd259
2 Replies

2. Shell Programming and Scripting

Adding strings to lines in a file

Hi all, I have a positional text file that comes from some source application. Before it is processed by destination application I have to add some header (suffix) to every record(line) in the file. e.g. Actual File ............... AccountDetails AcNO Name Amount 1234 John 26578 5678... (3 Replies)
Discussion started by: sharath160
3 Replies

3. Shell Programming and Scripting

Adding new lines to a file + adding suffix to a pattern

I need some help with adding lines to file and substitute a pattern. Ok I have a file: #cat names.txt name: John Doe stationed: 1 name: Michael Sweets stationed: 41 . . . And would like to change it to: name: John Doe employed permanently stationed: 1-office (7 Replies)
Discussion started by: hemo21
7 Replies

4. Shell Programming and Scripting

Delete lines in file containing duplicate strings, keeping longer strings

The question is not as simple as the title... I have a file, it looks like this <string name="string1">RZ-LED</string> <string name="string2">2.0</string> <string name="string2">Version 2.0</string> <string name="string3">BP</string> I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies

5. Shell Programming and Scripting

AWK adding prefix/suffix to list of strings

75 103 131 133 138 183 197 221 232 234 248 256 286 342 368 389 463 499 524 538 (5 Replies)
Discussion started by: chrisjorg
5 Replies

6. UNIX for Dummies Questions & Answers

Adding variables to repeating strings

Hello, I want to add a letter to the end of a string if it repeats in a column. so if I have a file like this: DOG001 DOG0023 DOG004 DOG001 DOG0023 DOG001 the output should look like this: DOG001-a DOG0023-a DOG004 DOG001-b (15 Replies)
Discussion started by: verse123
15 Replies

7. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies

8. UNIX for Beginners Questions & Answers

Use strings from nth field from one file to match strings in entire line in another file, awk

I cannot seem to get what should be a simple awk one-liner to work correctly and cannot figure out why. I would like to use patterns from a specific field in one file as regex to search for matching strings in the entire line ($0) of another file. I would like to output the lines of File2 which... (1 Reply)
Discussion started by: jvoot
1 Replies

9. UNIX for Beginners Questions & Answers

Adding to an array in an external file, and adding elements to it.

I have an array in an external file, "array.txt", which contains: char *testarray={"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};I want to be able to add an element to this array, and have that element display, whenever I call it, without having to recompile... (29 Replies)
Discussion started by: ignatius
29 Replies

10. Shell Programming and Scripting

Adding sequential index to duplicate strings

I have a text file in the following format >Homo sapiens KQKCLYNLPFKRNLEGCRERCSLVIQIPRCCKGYFGRDCQACPGGPDAPCNNRGVCLDQY SATGECKCNTGFNGTACEMCWPGRFGPDCLPCGCSDHGQCDDGITGSGQCLCETGWTGPS CDTQAVLPAVCTPPCSAHATCKENNTCECNLDYEGDGITCTVVDFCKQDNGGCAKVARCS... (2 Replies)
Discussion started by: jerrild
2 Replies
OBJLINE(1)						      General Commands Manual							OBJLINE(1)

NAME
objline - create metafile line drawings of RADIANCE object(s) SYNOPSIS
objline [input ..] DESCRIPTION
Objline takes one or more RADIANCE scene files and produces four parallel line projections using calls to rad2mgf(1) and mgf2meta(1). The output must be redirected to a suitable destination for metafile(5) 2-d graphics, such as x11meta(1) or psmeta(1). The four projections presented are along the X-axis (displayed in the upper left quadrant), along the Y-axis (upper right), along the Z- axis (lower left) and an oblique view (lower right). If multiple RADIANCE input files are given, they are shown in different colors and line styles. (Materials are ignored, so materials files are best left out.) If no input files are given on the command line, the standard input is read. EXAMPLES
To create a line drawing of the RADIANCE file "myfile.rad" and display under X11: objline myfile.rad | x11meta -r & To create a line drawing of three objects in different colors and send to the printer: objline obj1.rad obj2.rad obj3.rad | psmeta | lpr To create a line drawing of a room and convert into a 1024x1024 RADIANCE picture: objline room.rad | meta2tga -x 1024 -y 1024 | ra_t8 -r > drawing.hdr AUTHOR
Greg Ward SEE ALSO
meta2tga(1), metafile(5), mgf2meta(1), psmeta(1), ra_t8(1), rad2mgf(1), x11meta(1) RADIANCE
10/27/95 OBJLINE(1)
All times are GMT -4. The time now is 05:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy