Sponsored Content
Top Forums Shell Programming and Scripting How to extract specific data and count number containing sets from a file? Post 302442499 by Daniel8472 on Wednesday 4th of August 2010 01:04:05 PM
Old 08-04-2010
Question How to extract specific data and count number containing sets from a file?

Hello everybody!

I am quit new here and hope you can help me.

Using an awk script I am trying to extract data from several files. The structure of the input files is as follows:

TimeStep parameter1 parameter2 parameter3 parameter4

e.g.

1 X Y Z L
1 D H Z I
1 H Y E W
2 D H G F
2 R T U V
3
.
.
.

I would like to count the number entries from time step 1, 2, 3... containing certain parameters, respectively.

I already wrote a script that is extracting entries with specific parameters. However I am still struggling with getting with the information how many entries of time step 1, 2 and 3 contain e.g. parameter Z in $4 (2 for time step 1 and 0 for all other in the example above).

I Would prefer to do everything within a single script awk because I got a lot of data and later only want to change the parameter selection.

I already tried to do it within for and while loops but it did not work as I wanted it to... well I am just starting with awkSmilie

Thanks for your help guys!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract specific data from xml format file.

Hi, I need to extract the start time value (bold, red font) under the '<LogEvent ID="Timer Start">' tag (black bold) from a file with the following pattern. There are other LogEventIDs listed in the file as well, making it harder for me to extract out the specific start time that I need. . .... (7 Replies)
Discussion started by: 60doses
7 Replies

2. Shell Programming and Scripting

Extract data from log file from or after the specific date

Hi , I am having a script which will start a process and appends the process related logs to a log file. The log file writes logs with every line starting with date in the format of: date +"%Y %b %d %H:%M:%S". So, in the script, before I start the process, I am storing the date as DATE=`date +"%Y... (5 Replies)
Discussion started by: chiru_h
5 Replies

3. Shell Programming and Scripting

extract the lines between specific line number from a text file

Hi I want to extract certain text between two line numbers like 23234234324 and 54446655567567 How do I do this with a simple sed or awk command? Thank you. ---------- Post updated at 06:16 PM ---------- Previous update was at 05:55 PM ---------- found it: sed -n '#1,#2p'... (1 Reply)
Discussion started by: return_user
1 Replies

4. Shell Programming and Scripting

Extract data into file with specific field specs

:confused: I have a tab delimited file that I need to extract data from and into a file with specific field specs. Each field has to be a certain amount of characters. So, the name field (from delimited file) might have only 15 characters but needs to be 25 (in new file) so I need to insert spaces... (5 Replies)
Discussion started by: criddel
5 Replies

5. UNIX for Dummies Questions & Answers

Extract a specific number from an XML file based on the start and end tags

Hello People, I have the following contents in an XML file ........... ........... .......... ........... <Details = "Sample Details"> <Name>Bob</Name> <Age>34</Age> <Address>CA</Address> <ContactNumber>1234</ContactNumber> </Details> ........... ............. .............. (4 Replies)
Discussion started by: sushant172
4 Replies

6. Shell Programming and Scripting

Extract specific data content from a long list of data

My input: Data name: ABC001 Data length: 1000 Detail info Data Direction Start_time End_time Length 1 forward 10 100 90 1 forward 15 200 185 2 reverse 50 500 450 Data name: XFG110 Data length: 100 Detail info Data Direction Start_time End_time Length 1 forward 50 100 50 ... (11 Replies)
Discussion started by: patrick87
11 Replies

7. Shell Programming and Scripting

Extract string from multiple file based on line count number

Hi, I search all forum, but I can not find solutions of my problem :( I have multiple files (5000 files), inside there is this data : FILE 1: 1195.921 -898.995 0.750312E-02-0.497526E-02 0.195382E-05 0.609417E-05 -2021.287 1305.479-0.819754E-02 0.107572E-01 0.313018E-05 0.885066E-05 ... (15 Replies)
Discussion started by: guns
15 Replies

8. Shell Programming and Scripting

how to count how many subdirectory containing more than a certain number of specific file type

hi I want to write a script which count the number of subdirectories in the current root directory that contain more than a specified number of files of a specific type. Is there an easy way to do this? Thanks Robert (2 Replies)
Discussion started by: piynik
2 Replies

9. Shell Programming and Scripting

Skip the delimiter with in double quotes and count the number of delimiters during data extract

Hi All, I'm stuck-up in finding a way to skip the delimiter which come within double quotes using awk or any other better option. can someone please help me out. Below are the details: Delimited: | Sample data: 742433154|"SYN|THESIS MED CHEM PTY.... (2 Replies)
Discussion started by: BrahmaNaiduA
2 Replies

10. Shell Programming and Scripting

How-To Extract specific data from a file.

data.txt has several information like the below.. <SERVER>:WEB:MYDOM01:/tmp/cong/MYDOM01,/tmp/app/MYDOM01 <WEBER>:CANES:https-web01,https-web02:/web/apps/https-web01/config <SERVER>:WEB:MYDOM07:/tmp/cong/MYDOM07,/tmp/app/MYDOM07... (7 Replies)
Discussion started by: mohtashims
7 Replies
tracker-extract(1)						   User Commands						tracker-extract(1)

NAME
tracker-extract - Extract metadata from a file. SYNOPSYS
tracker-extract [OPTION...] FILE... DESCRIPTION
tracker-extract reads the file and mimetype provided in stdin and extract the metadata from this file; then it displays the metadata on the standard output. NOTE: If a FILE is not provided then tracker-extract will run for 30 seconds waiting for DBus calls before quitting. OPTIONS
-?, --help Show summary of options. -v, --verbosity=N Set verbosity to N. This overrides the config value. Values include 0=errors, 1=minimal, 2=detailed and 3=debug. -f, --file=FILE The FILE to extract metadata from. The FILE argument can be either a local path or a URI. It also does not have to be an absolute path. -m, --mime=MIME The MIME type to use for the file. If one is not provided, it will be guessed automatically. -d, --disable-shutdown Disable shutting down after 30 seconds of inactivity. -i, --force-internal-extractors Use this option to force internal extractors over 3rd parties like libstreamanalyzer. -m, --force-module=MODULE Force a particular module to be used. This is here as a convenience for developers wanting to test their MODULE file. Only the MOD- ULE name has to be specified, not the full path. Typically, a MODULE is installed to /usr/lib/tracker-0.7/extract-modules/. This option can be used with or without the .so part of the name too, for example, you can use --force-module=foo Modules are shared objects which are dynamically loaded at run time. These files must have the .so suffix to be loaded and must con- tain the correct symbols to be authenticated by tracker-extract. For more information see the libtracker-extract reference documen- tation. -V, --version Show binary version. EXAMPLES
Using command line to extract metadata from a file: $ tracker-extract -v 3 -f /path/to/some/file.mp3 Using a specific module to extract metadata from a file: $ tracker-extract -v 3 -f /path/to/some/file.mp3 -m mymodule ENVIRONMENT
TRACKER_EXTRACTORS_DIR This is the directory which tracker uses to load the shared libraries from (used for extracting metadata for specific file types). These are needed on each invocation of tracker-store. If unset it will default to the correct place. This is used mainly for testing purposes. FILES
$HOME/.config/tracker/tracker-extract.cfg SEE ALSO
tracker-store(1), tracker-sparql(1), tracker-stats(1), tracker-info(1). tracker-extract.cfg(5). /usr/lib/tracker-0.7/extract-modules/ GNU
July 2007 tracker-extract(1)
All times are GMT -4. The time now is 04:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy