Adding specific text and spaces to each line in a text file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Adding specific text and spaces to each line in a text file
Prev   Next
# 1  
Old 08-25-2008
Adding specific text and spaces to each line in a text file

Hi,

I wanted to add specific text to each row in a text file containing three rows. Example:

0 8 7 6 5 5
7 8 9 0 7 9
7 8 9 0 1 2

And I want to add a 21 at the beginning of the first row, and blank spaces at the beginning of the second two rows. To get this:

21 0 8 7 6 5 5
7 8 9 0 7 9
7 8 9 0 1 2

Thanks in advance!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Tip to remove line endings and spaces on a pre-formatted text file?

Hi, At the moment, using Notepad++ to do a search and replace, manually section by section which is real painful. Yeah, so copying each section of the line of text and putting into a file and then search and replace, need at least 3-operations in Notepad++. Here's hoping I will be able to... (1 Reply)
Discussion started by: newbie_01
1 Replies

2. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

3. UNIX for Dummies Questions & Answers

[Help] Adding text to a variable line in a file

Hey guys, I need to write a script that will add a specific text at the end of a specific line (of a text file). but the line is a variable this is my text file : device_2 ansible_ssh_host=127.0.0.1 ansible_ssh_port=30000 ansible_ssh_user='root' device_2 ansible_ssh_host=127.0.0.1... (1 Reply)
Discussion started by: OdedOvdat
1 Replies

4. Shell Programming and Scripting

Adding text to the end of the specific line in a file(only to the first occurrence of it)

Hi, I want to add a text to the end of the specific line in a file. Now my file looks like this: 999 111 222 333 111 444 I want to add the string " 555" to the end of the first line contaning 111. Moreover, I want to insert a newline after this line containg the "000" string. The... (8 Replies)
Discussion started by: wenclu
8 Replies

5. UNIX for Dummies Questions & Answers

Adding tags to a specific column of a space delimited text file

I have a space delimited text file with two columns. I would like to add NA to the first column of the text file. Input: 19625 10.4791768259 19700 10.8146489183 19701 10.9084026759 19702 10.9861346978 19703 10.9304364984 Output: NA19625 10.4791768259 NA19700 10.8146489183... (1 Reply)
Discussion started by: evelibertine
1 Replies

6. Shell Programming and Scripting

adding a line to a text file

I have a tab delimited text file, id name distance 1 3325167 0.334561754018 2 3290488 0.389444269458 3 3288794 0.392312701782 4 3347602 0.392532202097 5 3295355 0.394394169485 I need to add a line after the header line. The first and third field of... (3 Replies)
Discussion started by: LMHmedchem
3 Replies

7. Shell Programming and Scripting

[bash help]Adding multiple lines of text into a specific spot into a text file

I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it. For example, Here is a portion of a zone file. IN NS ns1.domain.tld. IN NS ns2.domain.tld. IN ... (2 Replies)
Discussion started by: cdn_humbucker
2 Replies

8. Shell Programming and Scripting

adding new line after finding specific text

hello i need some help here are the contents of my file. test.txt this is filename 1.mp3 http://www.url.com/filenamehashed filename 2.mp3 http://www.url.com/fileamehashed something_else.zip http://www.url.com/filenamehashed so this file has 100 of these lines filename url I would... (9 Replies)
Discussion started by: mscice
9 Replies

9. Shell Programming and Scripting

adding text to end of each line in a file

I'm needing to add a "hour:min" to the end of each line in a document. The document in this case is only going to be one line. if this inserts it at the end, what needs to be changed to add something at the end... /bin/echo "%s/^/$filler/g\nwq!" | ex -s $oFile Thank you... (2 Replies)
Discussion started by: cubs0729
2 Replies

10. Shell Programming and Scripting

Adding Text To each line of a file

How would I add text to the beginning of each line in a text file in a script right after the file is created from another text file. (4 Replies)
Discussion started by: cubs0729
4 Replies
Login or Register to Ask a Question
ppmlabel(1)						      General Commands Manual						       ppmlabel(1)

NAME
       ppmlabel - add text to a portable pixmap

SYNOPSIS
       ppmlabel [-angle angle] [-background transparent | colour] [-colour colour] [-file filename] [-size textsize] [-text 'text string'] [-x
		column] [-y row] ...  [ppmfile]

DESCRIPTION
       ppmlabel uses the text drawing facilities of ppmdraw to add text to a portable pixmap.  The location, size, baseline angle, colour  of  the
       text  and  background colour (if any) are controlled by command line arguments.	The text can be specified on the command line or read from
       files.  Any number of separate text strings can be added by one invocation of ppmlabel, limited only by the maximum length of  the  command
       line.

       If no ppmfile is specified, ppmdraw reads its input pixmap from standard input.

OPTIONS
       The  arguments  on the ppmlabel command line are not options in the strict sense; they are commands which control the placement and appear-
       ance of the text being added to the input pixmap.  They are executed left to right, and any number of arguments may appear.

       All flags can be abbreviated to their shortest unique prefix.

       -angle angle
		 Sets the angle of the baseline of subsequent text.  angle is specified as an integral number of degrees,  measured  counterclock-
		 wise from the row axis of the pixmap.

       -background transparent | colour
		 If  the argument is ``transparent'', text is drawn over the existing pixels in the pixmap.  If a colour is given (see the -colour
		 switch below for information on how to specify colours), rectangles enclosing subsequent text are filled with that colour.

       -colour colour
		 Sets the colour for subsequent text.  The colour can be specified in five ways:

		 o	A name, assuming that a pointer to an X11-style colour names file was compiled in.

		 o	An X11-style hexadecimal specifier: rgb:r/g/b, where r g and b are each 1- to 4-digit hexadecimal numbers.

		 o	An X11-style decimal specifier: rgbi:r/g/b, where r g and b are floating point numbers between 0 and 1.

		 o	For backwards compatibility, an old-X11-style hexadecimal number: #rgb, #rrggbb, #rrrgggbbb, or #rrrrggggbbbb.

		 o	For backwards compatibility, a triplet of numbers separated by commas: r,g,b, where r g and b are floating  point  numbers
			between 0 and 1.  (This style was added before MIT came up with the similar rgbi style.)

       -file filename
		 Reads text from the file filename and draws it on successive lines.

       -size textsize
		 Sets the height of the tallest characters above the baseline to textsize pixels.

       -text 'text string'
		 Draws	the  given text string (which must be quoted if it contains spaces).  The location for subsequent text is advanced by 1.75
		 times the current textsize, which allows drawing multiple lines of text in a reasonable manner without specifying the position of
		 each line.

       -x column Sets  the column at which subsequent text will be left justified.  Depending on the shape of the first character, the actual text
		 may begin a few pixels to the right of this point.

       -y row	 Sets the row which will form the baseline of subsequent text.	Characters with descenders, such as ``y'', will extend below  this
		 line.

BUGS
       Text strings are restricted to 7 bit ASCII.  The text font used by ppmdraw doesn't include definitions for 8 bit ISO 8859/1 characters.

       When  drawing  multiple lines of text with a non-transparent background, it should probably fill the space between the lines with the back-
       ground colour.  This is tricky to get right when the text is rotated to a non-orthogonal angle.

       The -size, -x, and -y options MUST precede the -text option specifying the string they apply to, or they will be silently ignored in  favor
       of the defaults.

SEE ALSO
       ppmmake(1), ppm(5)

AUTHOR
						 Copyright (C) 1995 by John Walker (kelvin@fourmilab.ch)
							 WWW home page: http://www.fourmilab.ch/

       Permission  to  use,  copy,  modify,  and distribute this software and its documentation for any purpose and without fee is hereby granted,
       without any conditions or restrictions.	This software is provided ``as is'' without express or implied warranty.

								   14 June 1995 						       ppmlabel(1)