07-19-2005
How to extract data from a text file
Hello All,
Is there an easy way to extract data from a text file? The text file is actually a dump of a 2 page report with 6 columns and 122 lines. Example is
Report Tile
Type Product 1 Product 2 Product 3 Product 4 Product 5
Budget
Current
MTD
YTD.
Payments
Second Page of Report :
Report Tile
Type Product 6 Product 7 Product 8 Product 9 Grand Total
Budget
Current
MTD
YTD.
Payments
Say we only want to get the amount in :
Current - Product8, Product 9 and grand total.
MTD - Product8, product9 and Grand total
YTD - product8, product9 and Grand Total
Checking the text file, these are in rows 81, 82 and 83.
Thanks!
negixx
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello again, how do you extract data from a file? I have created a file with PID #s in it, I need to be able to take the PID from each line and kill it. How is this done? (4 Replies)
Discussion started by: raidzero
4 Replies
2. Shell Programming and Scripting
I m new to shell scripting & i need a help....
i have file like....
Name := sachin
address:=something
phone:=111
...
Note: There might be or not space between Name & := and between := & sachin. I need to extract the data from each line of file as
var1=Name
value1=sachin
same for... (13 Replies)
Discussion started by: ps_sach
13 Replies
3. Programming
needa c program to extract text between two delimiters from some text file.
and then storing them in to diffrent variables ?
text file like 0:
abc.txt
=========
aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass
aaaaaa|11111111|sssssssssss|333333|ddddddddd|34343454564|asass... (7 Replies)
Discussion started by: kukretiabhi13
7 Replies
4. Shell Programming and Scripting
Hi,
I need to extract data from a text file in which data has a pattern. I need to extract all repeated pattern and then save it to different files.
example:
input is:
ST*867*000352214
BPT*00*1000352214*090311
SE*1*1
ST*867*000352215
BPT*00*1000352214*090311
SE*1*2
... (5 Replies)
Discussion started by: apjneeraj
5 Replies
5. Shell Programming and Scripting
I am attempting to extract weather data from the following website, but for the Victoria area only:
Text Forecasts - Environment Canada
I use this:
sed -n "/Greater Victoria./,/Fraser Valley./p"
But that phrasing does not sometimes get it all and think perhaps the website has more... (2 Replies)
Discussion started by: lagagnon
2 Replies
6. Shell Programming and Scripting
hi
i am trying to extract some specific data out of a text file using regular expressions with shell script
that is using a multiline grep .. and the tool i am using is pcregrep so that i can get compatibility with perl's regular expressions
for a sample data like this, i am trying to grab... (6 Replies)
Discussion started by: vemkiran
6 Replies
7. Shell Programming and Scripting
Hi, Great minds, I have some files, in fact header files, of CTD profiler, I tried a lot C programming, could not get output as I was expected, because my programming skills are very poor, finally, joined unix forum with the hope that, I may get what I want, from you people,
Here I have attached... (17 Replies)
Discussion started by: nex_asp
17 Replies
8. Shell Programming and Scripting
Hello all,
I have a file (filename.txt) with some data (in two columns X and Y) which looks like this:
##########
'Header1'
'Sub-header1'
X Y
xxxx.xx yyyy.yyy
xxxx.xx yyyy.yyy
.... ...
'Sub-header2'
X Y
xxxx.xx ... (7 Replies)
Discussion started by: jaldo0805
7 Replies
9. Shell Programming and Scripting
I have a text file that contains the following data. For example, aa.txt has some numbers. I need to extract the continuous numbers(minimum 3 numbers) from it.How can I do this with awk?
>aa.txt
31
35
36
37
38
39
44
169
170
173
174
175
177
206
>1a.txt
39 (5 Replies)
Discussion started by: rahmanabdulla
5 Replies
10. UNIX for Beginners Questions & Answers
hi I made this simple script to extract data and pretty much is a list and would like to extract data of two words separated by commas and I would like to make a new text file that would list these extracted data into a list and each in a new line.
Example that worked for me with text file... (5 Replies)
Discussion started by: dandaryll
5 Replies
dump(1) User Commands dump(1)
NAME
dump - dump selected parts of an object file
SYNOPSIS
dump [-aCcfghLorstV [-p]] [ -T index [ , indexn]] filename...
dump [ -afhorstL [-p] [v]] filename...
dump [ -hsr [-p] [ -d number [ , numbern]]] filename...
dump [ -hsrt [-p] [-n name]] filename...
DESCRIPTION
The dump utility dumps selected parts of each of its object file arguments.
The dump utility is best suited for use in shell scripts, whereas the elfdump(1) command is recommended for more human-readable output.
OPTIONS
This utility will accept both object files and archives of object files. It processes each file argument according to one or more of the
following options:
-a Dumps the archive header of each member of an archive.
-c Dumps the string table(s).
-C Dumps decoded C++ symbol table names.
-f Dumps each file header.
-g Dumps the global symbols in the symbol table of an archive.
-h Dumps the section headers.
-L Dumps dynamic linking information and static shared library information, if available.
-o Dumps each program execution header.
-r Dumps relocation information.
-s Dumps section contents in hexadecimal.
-t Dumps symbol table entries.
-T index Dumps only the indexed symbol table entry defined by index or a range of entries defined by index1,index2.
-T index1,index2
-V Prints version information.
The following modifiers are used in conjunction with the options listed above to modify their capabilities.
-d number Dumps the section number indicated by number or the range of sections starting at number1 and ending at number2.
-d number1,number2 This modifier can be used with -h, -s, and -r. When -d is used with -h or -s, the argument is treated as the number
of a section or range of sections. When -d is used with -r, the argument is treated as the number of the section or
range of sections to which the relocation applies. For example, to print out all relocation entries associated with
the .text section, specify the number of the section as the argument to -d. If .text is section number 2 in the
file, dump -r -d 2 will print all associated entries. To print out a specific relocation section, use dump -s -n
name for raw data output, or dump -sv -n name for interpreted output.
-n name Dumps information pertaining only to the named entity. This modifier can be used with -h, -s, -r, and -t. When -n
is used with -h or -s, the argument will be treated as the name of a section. When -n is used with -t or -r, the
argument will be treated as the name of a symbol. For example, dump -t -n .text will dump the symbol table entry
associated with the symbol whose name is .text, where dump -h -n .text will dump the section header information
for the .text section.
-p Suppresses printing of the headings.
-v Dumps information in symbolic representation rather than numeric. This modifier can be used with
-a (date, user id, group id)
-f (class, data, type, machine, version, flags)
-h (type, flags)
-L (value)
-o (type, flags)
-r (name, type)
-s (interpret section contents wherever possible)
-t (type, bind)
When -v is used with -s, all sections that can be interpreted, such as the string table or symbol table, will be
interpreted. For example, dump -sv -n .symtab filename... will produce the same formatted output as dump -tv file-
name..., but dump -s -n .symtab filename... will print raw data in hexadecimal. Without additional modifiers, dump
-sv filename... will dump all sections in the files, interpreting all those that it can and dumping the rest (such
as .text or .data) as raw data.
The dump utility attempts to format the information it dumps in a meaningful way, printing certain information in character, hexadecimal,
octal, or decimal representation as appropriate.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWbtool |
+-----------------------------+-----------------------------+
SEE ALSO
elfdump(1), nm(1), ar.h(3HEAD), a.out(4), attributes(5)
SunOS 5.10 6 Sep 2002 dump(1)