Sponsored Content
Top Forums Shell Programming and Scripting Extracting the lines between 2 strings of a file Post 302107072 by babloo on Wednesday 14th of February 2007 06:17:26 AM
Old 02-14-2007
Extracting the lines between 2 strings of a file

Hi,

I have a sql file and i need to extract the table names used in the sql file using a unix script. If i can extract the lines between the keywords 'FROM' and 'WHERE' in the file, my job is done. can somebody tell me how to do this using a shell script. If u can just let me know, how to extract the lines between 2 strings, it would be a great help.
Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extracting lines from a file

Hi all, I need to extract some lines from a file based on a condition. For ex: My file will contain 50 lines and i need to extract line which has "File" in it and then the line which has "date" in it. Which command will be the most efficient way to do it. I have tried two ways 1.... (1 Reply)
Discussion started by: pradeepthanraj
1 Replies

2. Shell Programming and Scripting

Help with extracting strings from a file

I want to collect the characters from 1-10 and 20-30 from each line of the file and take them in a file in the following format.Can someone help me with this : string1,string2 string1,string2 string1,string2 : : : : (7 Replies)
Discussion started by: cmsdelhi
7 Replies

3. Shell Programming and Scripting

extracting a set of strings from a text file

i have textfiles that contain a series of lines that look like this: string0 .................................................... column3a column4a string1**384y0439 ..................................... column3b column4b... (2 Replies)
Discussion started by: Deanne
2 Replies

4. Shell Programming and Scripting

Extracting lines between 2 strings only if the pattern patches

Hi Friends, Please help me with the following problem: I have an xml file with the following lines: <init-param> <param-name>/default/directory</param-name> <param-value>default</param-value> </init-param> <init-param> ... (5 Replies)
Discussion started by: simran
5 Replies

5. UNIX for Dummies Questions & Answers

extracting lines from a file

i want to extract lines 5 and 7 from a txt file which contains nearly 20 entries how to do it also i want to check whether the 42nd character is 'S' in that line suggestions welcome (4 Replies)
Discussion started by: trichyselva
4 Replies

6. UNIX for Advanced & Expert Users

Extracting Lines in a file

Hi, We have a file where we need to extract the lines of a file based on the first three characters of every line in that file. Eg: RAM hill station SAM student RAM rose SAM apple RAM india SAM australia RAM happy RAM heaven SAM smile RAM glow So, all the lines that start... (5 Replies)
Discussion started by: pyaranoid
5 Replies

7. Shell Programming and Scripting

Extracting specific lines of data from a file and related lines of data based on a grep value range?

Hi, I have one file, say file 1, that has data like below where 19900107 is the date, 19900107 12 144 129 0.7380047 19900108 12 168 129 0.3149017 19900109 12 192 129 3.2766666E-02 ... (3 Replies)
Discussion started by: Wynner
3 Replies

8. Shell Programming and Scripting

Extracting strings from a log file.

I'm new to all this and I've been fiddling with this problem for HOURS and feel silly that I can't work it out! I have a .log file that VERY long and looks like this: 2011-08-31 10:03:34 SUESTART AG Amndmnt Client WebRequest DNU SUEEND Sequence: 600, 2011-08-31 10:03:34 SUESTART... (11 Replies)
Discussion started by: SusieSA
11 Replies

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

10. UNIX for Beginners Questions & Answers

Extracting strings at various positions of text file

Hi Team - I hope everyone has been well! I export a file from one of our source systems that gives me more information than I need. The way the file outputs, I need to extract certain strings at different positions on the file and echo them to another file. I can do this in batch easily,... (2 Replies)
Discussion started by: SIMMS7400
2 Replies
EXTRACT(1)						      General Commands Manual							EXTRACT(1)

NAME
extract - determine meta-information about a file SYNOPSIS
extract [ -bghLnvV ] [ -H hash-algorithm ] [ -i ] [ -l library ] [ -p type ] [ -x type ] file ... DESCRIPTION
This manual page documents version 0.6.0 of the extract command. extract tests each file specified in the argument list in an attempt to infer meta-information from it. Each file is subjected to the meta-data extraction libraries from libextractor. libextractor classifies meta-information (also referred to as keywords) into types. A list of all types can be obtained with the -L option. OPTIONS
-b Display the output in BiBTeX format. -g Use grep-friendly output (all keywords on a single line for each file). Use the verbose option to print the filename first, fol- lowed by the keywords. Use the verbose option twice to also display the keyword types. This option will not print keyword types or non-textual metadata. -h Print a brief summary of the options. -i Run plugins in-process (for debugging). By default, each plugin is run in its own process. -l libraries Use the specified libraries to extract keywords. The general format of libraries is .I [[-]LIBRARYNAME[:[-]LIBRARYNAME]*] where LIBRARYNAME is a libextractor compatible library and typically of the form .Ijpeg. The minus before the libraryname indicates that this library should be removed from the existing list. To run only a few selected plugins, use -l in combination with -n. -L Print a list of all known keyword types. -n Do not use the default set of extractors (typically all standard extractors, currently mp3, ogg, jpg, gif, png, tiff, real, html, pdf and mime-types), use only the extractors specified with the .B -l option. -p type Print only the keywords matching the specified type. By default, all keywords that are found and not removed as duplicates are printed. -v Print the version number and exit. -V Be verbose. This option can be specified multiple times to increase verbosity further. -x type Exclude keywords of the specified type from the output. By default, all keywords that are found and not removed as duplicates are printed. SEE ALSO
libextractor(3) - description of the libextractor library EXAMPLES
$ extract test/test.jpg comment - (C) 2001 by Christian Grothoff, using gimp 1.2 1 mimetype - image/jpeg $ extract -V -x comment test/test.jpg Keywords for file test/test.jpg: mimetype - image/jpeg $ extract -p comment test/test.jpg comment - (C) 2001 by Christian Grothoff, using gimp 1.2 1 $ extract -nV -l png.so -p comment test/test.jpg test/test.png Keywords for file test/test.jpg: Keywords for file test/test.png: comment - Testing keyword extraction LEGAL NOTICE
libextractor and the extract tool are released under the GPL. libextractor is a GNU package. BUGS
A couple of file-formats (on the order of 10^3) are not recognized... AUTHORS
extract was originally written by Christian Grothoff <christian@grothoff.org> and Vidyut Samanta <vids@cs.ucla.edu>. Use <libextrac- tor@gnu.org> to contact the current maintainer(s). AVAILABILITY
You can obtain the original author's latest version from http://www.gnu.org/software/libextractor/ libextractor 0.6.0 Dec 20, 2009 EXTRACT(1)
All times are GMT -4. The time now is 03:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy