Sponsored Content
Top Forums Shell Programming and Scripting sed or awk to parse this text Post 302449531 by bulgin on Monday 30th of August 2010 11:25:27 PM
Old 08-31-2010
Thank you, Agama for clearing that up. when I run it as a bash script using test_file.txt, it runs and produces no output. Nor does it produce errors.

Here are a couple of lines of the test_file.txt:

* [44]Amateur Astronomy and Space Website - Images, CCD information,
buy and sell, and links.
* [45]Ask an Astronomer - Questions answered by graduate students,
including a question and answer archive, information on the solar
system, the universe, SETI, observational astronomy, careers and
history.
* [46]Astro World - Provides studies, images, movies, and equations.
* [47]Astronomical Observatory - Visual and CCD photomety, including
classic and digital astrophotography. Presents equipment and
resources. Located near Plomin in eastern Istria, Croatia.
* [48]Astronomy Awards - Supporting the hobby related web sites
throughout world.
* [49]Astronomy Boy - Getting started, CG-5 mount, SAA 100 list,
constellation portraits, barn door tracker, comet Hale Bopp,
homemade eyepieces, EQ mount tutorial, millennium rant, and
biography, home.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To parse through the file and print output using awk or sed script

suppose if u have a file like that Hen ABCCSGSGSGJJJJK 15 Cock ABCCSGGGSGIJJJL 15 * * * * * * : * * * . * * * : Hen CFCDFCSDFCDERTF 30 Cock CHCDFCSDHCDEGFI 30 * . * * * * * * * : * * :* : : . The output shud be where there is : and . It shud... (4 Replies)
Discussion started by: cdfd123
4 Replies

2. Shell Programming and Scripting

awk/sed Command : Parse parameter file / send the lines to the ksh export command

Sorry for the duplicate thread this one is similar to the one in https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121 Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies

3. Shell Programming and Scripting

awk/sed Command: To Parse Stament between 2 numbers

Hi, I need an awk command that would parse the below expression Input Format 1 'Stmt1 ............................'2 'Stmt2 ............................'3 'Stmt3 ............................'4 'Stmt4 ............................'5 'Stmt5 ............................'6 'Stmt6... (1 Reply)
Discussion started by: rajan_san
1 Replies

4. Shell Programming and Scripting

parse xm entry with awk/sed

Hi folks, I have XML files with the following sections (section occurs once per file) in them: <AuthorList CompleteYN="Y"> <Author ValidYN="Y"> <LastName>Bernal</LastName> <ForeName>Federico</ForeName> ... (3 Replies)
Discussion started by: euval
3 Replies

5. Shell Programming and Scripting

Use awk or sed to parse delimited string

Hi I am trying to figure out the best way to search a long log file and print out certain information. For example if I had a line in a log file delimited by ampersand first_name=mike&last_name=smith&zip_code=55555&phone=555-5555&state=ma&city=boston and I only wanted to search for and... (3 Replies)
Discussion started by: mstefaniak
3 Replies

6. Shell Programming and Scripting

sed/awk script to parse list of bandwidth rules

Hello all gurus, I have a long list of rules as below: 20 name:abc addr:203.45.247.247/255.255.255.255 WDW-THRESH:12 BW-OUT:10000000bps BW-IN:15000000bps STATSDEVICE:test247 STATS:Enabled (4447794/0) <IN OUT> 25 name:xyz160 addr:203.45.233.160/255.255.255.224 STATSDEVICE:test160... (3 Replies)
Discussion started by: sb245
3 Replies

7. Shell Programming and Scripting

[solved] Awk/shell question to parse hour minute from text

Hi, I have a quick question on parsing the hour/minute and value from a text file and remove the seconds portion. For example in the below text file: 20:26:01 95.83 20:27:01 96.06 20:28:01 95.99 20:29:01 7.11 20:30:01 5.16 20:31:01 8.27 20:32:02 9.79 20:33:01 11.27 20:34:01 7.83... (2 Replies)
Discussion started by: satishrao
2 Replies

8. Shell Programming and Scripting

awk to parse file and display result based on text

I am trying using awk to open an input file and check a column 2/field $2 and if there is a warning then that is displayed (variantchecker): G not found at position 459, found A instead. The attached Sample1.txt is that file. If in that column/field there is a black space, then the text after... (6 Replies)
Discussion started by: cmccabe
6 Replies

9. Shell Programming and Scripting

awk or sed? rows text to co

Hello Friends! I would like to help the masters ... I have a file with the entry below and would like a script for that output: Input file: 001 1 01-20152142711532-24S 1637909825/05/2015BAHIA SERVICOS R F, ... (1 Reply)
Discussion started by: He2
1 Replies

10. Shell Programming and Scripting

awk to parse field and include the text of 1 pipe in field 4

I am trying to parse the input in awk to include the |gc= in $4 but am not able to. The below is close: awk so far: awk '{sub(/\|]+]++/, ""); print }' input.txt Input chr1 955543 955763 AGRN-6|pr=2|gc=75 0 + chr1 957571 957852 AGRN-7|pr=3|gc=61.2 0 + chr1 970621 ... (7 Replies)
Discussion started by: cmccabe
7 Replies
Astro::FITS::Header::Item(3pm)				User Contributed Perl Documentation			    Astro::FITS::Header::Item(3pm)

NAME
Astro::FITS::Header::Item - A card image from a FITS header SYNOPSIS
$item = new Astro::FITS::Header::Item( Card => $card ); $item = new Astro::FITS::Header::Item( Keyword => $keyword, Value => $value, Comment => $comment, Type => 'int' ); $value = $item->value(); $comment = $item->comment(); $card = $item->card(); $card = "$item"; DESCRIPTION
Stores information about a FITS header item (in the FITS standard these are called Card Images). FITS Card Images can be parsed and broken into their component keyword, values and comments. Card Images can also be created from its components keyword, value and comment. METHODS
Constructor new Create a new instance. Optionally can be given a hash containing information from a header item or the card image itself. $item = new Astro::FITS::Header::Item( Card => $card ); $item = new Astro::FITS::Header::Item( Keyword => $keyword, Value => $value ); The list of allowed hash keys is documented in the configure method. Returns "undef" if the information supplied was insufficient to generate a valid header item. copy Make a copy of an Astro::FITS::Header::Item object. $newitem = $item->copy; Accessor Methods keyword Return (or set) the value of the keyword associated with the FITS card. $keyword = $item->keyword(); $item->keyword( $key ); When a new value is supplied any "card" in the cache is invalidated. Supplied value is always upper-cased. value Return (or set) the value of the value associated with the FITS card. $value = $item->value(); $item->value( $val ); When a new value is supplied any "card" in the cache is invalidated. If the value is an "Astro::FITS::Header" object, the type is automatically set to "HEADER". comment Return (or set) the value of the comment associated with the FITS card. $comment = $item->comment(); $item->comment( $comment ); When a new value is supplied any "card" in the cache is invalidated. type Return (or set) the value of the variable type associated with the FITS card. $type = $item->type(); $item->type( "INT" ); Allowed types are "LOGICAL", "INT", "FLOAT", "STRING", "COMMENT", "HEADER" and "UNDEF". The special type, "HEADER", is used to specify that this item refers to a subsidiary header (eg a header in an MEFITS file or a header in an NDF in an HDS container). See also the "subhdrs" method in "Astro::FITS::Header" for an alternative way of specifying a sub- header. The type is case-insensitive, but will always be returned up-cased. card Return (or set) the 80 character header card associated with this object. It is created if there is no cached version. $card = $item->card(); If a new card is supplied it will only be accepted if it is 80 characters long or fewer. The string is padded with spaces if it is too short. No attempt (yet) )is made to shorten the string if it is too long since that may require a check to see if the value is a string that must be shortened with a closing single quote. Returns "undef" on assignment failure (else returns the supplied string). $status = $item->card( $card ); "undef" is returned if there is insufficient information in the object to create a new card. Can assign "undef" to clear the cache. This method is called automatically when attempting to stringify the object. $card = "$item"; General Methods configure Configures the object from multiple pieces of information. $item->configure( %options ); Takes a hash as argument with the following keywords: Card If supplied, the value is assumed to be a standard 80 character FITS header card. This is sent to the "parse_card" method directly. Takes priority over any other key. If it is an "Astro::FITS::Header::Item" it will be copied rather than parsed. Keyword Used to specify the keyword associated with this object. Value Used to specify the value associated with this FITS item. Comment Used to specify the comment associated with this FITS item. Type Used to specify the variable type. See the "type" method for more details. A type will be guessed if one is not supplied. The guess may well be wrong. Does nothing if these keys are not supplied. freeze Method to return a blessed reference to the object so that we can store ths object on disk using Data::Dumper module. parse_card Parse a FITS card image and store the keyword, value and comment into the object. ($key, $val, $com) = $item->parse_card( $card ); Returns an empty list on error. equals Compares this Item with another and returns true if the keyword, value, type and comment are all equal. $isident = $item->equals( $item2 ); SEE ALSO
"Astro::FITS::Header" COPYRIGHT
Copyright (C) 2008-2009 Science and Technology Facilities Council. Copyright (C) 2001-2007 Particle Physics and Astronomy Research Council. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,Suite 330, Boston, MA 02111-1307, USA AUTHORS
Tim Jenness <t.jenness@jach.hawaii.edu>, Alasdair Allan <aa@astro.ex.ac.uk> perl v5.14.2 2012-06-30 Astro::FITS::Header::Item(3pm)
All times are GMT -4. The time now is 11:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy