Extracting lines from a text file based on another text file with line numbers


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Extracting lines from a text file based on another text file with line numbers
Prev   Next
# 1  
Old 12-11-2012
Extracting lines from a text file based on another text file with line numbers

Hi,

I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies

2. Shell Programming and Scripting

Extracting values based on line-column numbers from multiple text files

Dear All, I have to solve the following problems with multiple tab-separated text file but I don't know how. Any help would be greatly appreciated. I have access to Linux mint (but not as a professional). I have multiple tab-delimited files with the following structure: file1: 1 44 2 ... (5 Replies)
Discussion started by: Bastami
5 Replies

3. Shell Programming and Scripting

Extracting lines from text files in folder based on the numbers in another file

Hello, I have a file ff.txt that looks as follows *ABNA.txt 356 24 36 112 *AC24.txt 457 458 321 2 ABNA.txt and AC24.txt are the files in the folder named foo1. Based on the numbers in the ff.txt file, I want to extract the lines from the corresponding files in the foo1 folder and... (2 Replies)
Discussion started by: mohamad
2 Replies

4. Shell Programming and Scripting

How to delete lines of a text file based on another text file?

I have 2 TXT files with with 8 columns in them(tab separated). First file has 2000 entries whereas 2nd file has 300 entries. The first file has ALL the lines of second file. Now I need to remove those 300 lines (which are in both files) from first file so that first file's line count become... (2 Replies)
Discussion started by: prvnrk
2 Replies

5. UNIX for Dummies Questions & Answers

Extracting rows from a text file based on the values of two columns (given ranges)

Hi, I have a tab delimited text file with multiple columns. The second and third columns include numbers that have not been sorted. I want to extract rows where the second column includes a value between -0.01 and 0.01 (including both numbers) and the first third column includes a value between... (1 Reply)
Discussion started by: evelibertine
1 Replies

6. Shell Programming and Scripting

Extracting Multiple Lines from a Text File

Hello. I am sorry if this is a common question but through all my searching, I haven't found an answer which matches what I want to do. I am looking for a sed command that will parse through a large text file and extract lines that start with specific words (which are repeated throughout the... (4 Replies)
Discussion started by: MrDumbQuestion
4 Replies

7. UNIX for Dummies Questions & Answers

Extracting rows from a text file based on the first column

I have a tab delimited text file where the first column can take on three different values : 100, 150, 250. I want to extract all the rows where the first column is 100 and put them into a separate text file and so on. This is what my text file looks like now: 100 rs3794811 0.01 0.3434 100... (1 Reply)
Discussion started by: evelibertine
1 Replies

8. UNIX for Dummies Questions & Answers

Extracting rows from a text file based on the first column

I have a tab delimited text file where the first column can take on three different values : 100, 150, 250. I want to extract all the rows where the first column is 100 and put them into a separate text file and so on. This is what my text file looks like now: 100 rs3794811 0.01 0.3434... (1 Reply)
Discussion started by: evelibertine
1 Replies

9. Shell Programming and Scripting

extracting unique lines from text file

I have a file with 14million lines and I would like to extract all the unique lines from the file into another text file. For example: Contents of file1 happy sad smile happy funny sad I want to run a command against file one that only returns the unique lines (ie 1 line for happy... (3 Replies)
Discussion started by: soliberus
3 Replies

10. Shell Programming and Scripting

Extracting data from text file based on configuration set in config file

Hi , a:) i have configuration file with pattren <Range start no>,<Range end no>,<type of records to be extracted from the data file>,<name of the file to store output> eg: myfile.confg 9899000000,9899999999,DATA,b.dat 9899000000,9899999999,SMS,a.dat b:) Stucture of my data file is... (3 Replies)
Discussion started by: suparnbector
3 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)