Visit Our UNIX and Linux User Community

Top Forums Shell Programming and Scripting Extract specific data and change its arrangment Post 302408936 by patrick87 on Tuesday 30th of March 2010 11:48:02 PM
Old 03-31-2010
Hi ktrimu,
I just try the awk code that you suggested.
Unfortunately, it can't give my desired output result Smilie
Your awk code give the output result same as what my wrong awk code did Smilie
awk '{if($3 ~ /type/ || /range/ || /source/) { var=$0; if($var ! $0) {print;} }}' filename
HS04636    PROGRAM    source    836    7001        +    ID=g1
HS04636    PROGRAM    type    836    1017        +    Parent=g1.t1
HS04636    PROGRAM    range    966    1017        +    ID=g1.t1.range;Parent=g1.t1
HS04636    PROGRAM    range    1818    1934        +    ID=g1.t1.range;Parent=g1.t1
HS04636    PROGRAM    type    1818    1934        +    Parent=g1.t1
HS04636    PROGRAM    range    2055    2198        +    ID=g1.t1.range;Parent=g1.t1
HS04636    PROGRAM    type    2055    2198        +    Parent=g1.t1

HS04636    PROGRAM    source    836    7001        +    ID=g1
HS04636    PROGRAM    range    2852    2995        +    ID=g1.t1.range;Parent=g1.t1
HS04636    PROGRAM    type    2852    2995        +    Parent=g1.t1
HS04636    PROGRAM    range    3426    3607        +    ID=g1.t1.range;Parent=g1.t1
HS04636    PROGRAM    type    3426    3607        +    Parent=g1.t1

Do you got any better advice or suggestion to improve the awk code to reach my desired output result?
Thanks again and a lot for your advice.
Test Your Knowledge in Computers #374
Difficulty: Easy
In 2004, a new edition of the POSIX:2002 standard was released called POSIX:2004 (formally: IEEE Std 1003.1-2004).
True or False?

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

4. Shell Programming and Scripting

Extract all the content after a specific data

Discussion started by: patrick87
22 Replies

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

6. Shell Programming and Scripting

Extract specific read from a data

Input file: #abc_1 SAASFASFGGDSGDSGDSGSDGSDGSDGSDGSDGSDGSDGDS Output file: FASFGGDSGDS I just want to print out the read from position 5 until position 15 from the data. Below is the code that I just try but it is failed to get my desired output: grep -v '#' input_file | awk... (5 Replies)
Discussion started by: patrick87
5 Replies

7. Shell Programming and Scripting

Extract data based on specific search criteria

I have a huge file (about 2 millions records) contains data separated by “,” (comma). As part of the requirement, I can't change the format. The objective is to remove some of the records with the following condition. If the 23rd field on each line start with 302 , I need to remove that from the... (4 Replies)
Discussion started by: jaygamini
4 Replies

8. HP-UX

How to extract data for a specific process from ovpa?

Hi Friends, One question. Supposed I want to extract data only for process named "sqlplus" how can I do it. Any suggestions? I don't want all the data as it is not useful to me e.g.. Command I use is given below extract -xp -p -r repfile -b"03/15/13 7:00 PM" -e"03/15/13 09:30 PM" -f... (1 Reply)
Discussion started by: kunwar
1 Replies

9. Shell Programming and Scripting

How to extract specific data?

Bash scripting beginner here... I have many folders, each folder representing one subject. Not all subjects have all the required files, so I need to somehow cycle through all the data and then extract the data only from subjects who have no files missing. I tried to output the ls command, but... (4 Replies)
Discussion started by: LeftoverStew
4 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
wxStaticLine(3erl)					     Erlang Module Definition						wxStaticLine(3erl)

wxStaticLine - See external documentation: wxStaticLine. DESCRIPTION
See external documentation: wxStaticLine . This class is derived (and can use functions) from: wxControl wxWindow wxEvtHandler DATA TYPES
wxStaticLine() : An object reference, The representation is internal and can be changed without notice. It can't be used for comparsion stored on disc or distributed for use on other nodes. EXPORTS
new() -> wxStaticLine() See external documentation . new(Parent::wxWindow() (see module wxWindow)) -> wxStaticLine() Equivalent to new(Parent, []) . new(Parent::wxWindow() (see module wxWindow), Options::[Option]) -> wxStaticLine() Types Option = {id, integer()} | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} See external documentation . create(This::wxStaticLine(), Parent::wxWindow() (see module wxWindow)) -> bool() Equivalent to create(This, Parent, []) . create(This::wxStaticLine(), Parent::wxWindow() (see module wxWindow), Options::[Option]) -> bool() Types Option = {id, integer()} | {pos, {X::integer(), Y::integer()}} | {size, {W::integer(), H::integer()}} | {style, integer()} See external documentation . isVertical(This::wxStaticLine()) -> bool() See external documentation . getDefaultSize() -> integer() See external documentation . destroy(This::wxStaticLine()) -> ok Destroys this object, do not use object again AUTHORS
<> wxErlang 0.98.9 wxStaticLine(3erl)

Featured Tech Videos

All times are GMT -4. The time now is 07:25 PM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy