Sponsored Content
Full Discussion: Grep & print
Top Forums UNIX for Dummies Questions & Answers Grep & print Post 302245308 by gunaah on Thursday 9th of October 2008 09:18:00 PM
Old 10-09-2008
Grep & print

I just need to print value 12 digit number after the key *MI*. My big concern is the below lines are not fixed format or length so cant cut based on the position.


XSA*00**00**XZ*DA-Paper*30*942411167****MI*010001990802~AEE
XSA*00**00**ZZ*EA-aper*30*94169****MI*010001960802~SDRE*ER
SSA*00**00**CZ*BA-Paper*30*2411167****MI*010001790802~AD*a*
XSA*00**00**ZZ*DA-Raper*30*942167****MI*010001980802~A*c8*
XSA*00**00**ZA*DA-Raper*30*9424111****MI*010001880802~ae*ae

Basically I need the output as
*010001990802~
*010001960802~
*010001790802~
*010001980802~

Thanks in advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PHP & MySQL: sort desending and print

How do i get php to sort the times in a table and print order desending. eg: in the table i have: 02:60.00 02:70.00 02:20.00 02:50.00 in that order in a table how do i get php & mysql to print... (1 Reply)
Discussion started by: perleo
1 Replies

2. Shell Programming and Scripting

awk pipes & print

Hi, I need to awk some data from some text files, basic stuff, eg: awk '/phrase/ {print $1,$2,$3}' file Which will print columns 1 to 3 of all lines containing "phrase" But what if I wanted to pipe just one of the columns to a command (in my case a date converter) as in: awk... (4 Replies)
Discussion started by: Jonny2Vests
4 Replies

3. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

4. UNIX for Dummies Questions & Answers

Difference between grep, egrep & grep -i

Hi All, Please i need to know the difference between grep, egrep & grep -i when used to serach through a file. My platform is SunOS 5.9 & i'm using the korn shell. Regards, - divroro12 - (2 Replies)
Discussion started by: divroro12
2 Replies

5. Shell Programming and Scripting

Find a string using grep & print the line above or below that.

Hi All, Please tell me how can I Find a string using grep & print the line above or below that in solaris? Please share as I am unable to use grep -A or grep -B as it is not working on Solaris. (10 Replies)
Discussion started by: Zaib
10 Replies

6. Shell Programming and Scripting

compare & print lines with 2 requirements

1.compare 90 logs >20 print off with correct figure 2.compare latest log i.e ciscoresets_20120314 against all records not just the 90 (as above) and any lines not matching print as: NEW:SYDGRE04,10,9 1 (note this number could be 2 or whatever not necessary 1 it could be 2,3 or even 10... (2 Replies)
Discussion started by: slashbash
2 Replies

7. Shell Programming and Scripting

Using Grep & find & while read line in a script

Hello people! I would like to create one script following this stage I have one directory with 100 files File001 File002 ... File100 (This is the format of content of the 100 files) 2012/03/10 12:56:50:221875936 1292800448912 12345 0x00 0x04 0 then I have one... (0 Replies)
Discussion started by: Abv_mx81
0 Replies

8. Shell Programming and Scripting

awk question: How to print condition of NR & NF together.

Experts: LINE1 :This is line one The FIRST line of the file. LINE2 :This is line two LINE3 :This is line three with 8 fileds LINE4 :This is line four LINE5 :This is line five LINE6 :This is line six with 8 fileds I want to delete line 1, and then process the file and want to print lines... (2 Replies)
Discussion started by: rveri
2 Replies

9. UNIX for Dummies Questions & Answers

How to create a print filter that print text & image?

Currently, I have a print filter that takes a text file, that convert it into PCL which then gets to a HP printer. This works. Now I need to embedded a image file within the text file. I'm able to convert the image file into PCL and I can cat both files together to into a single document... (1 Reply)
Discussion started by: chedlee88-1
1 Replies

10. Shell Programming and Scripting

How to print & and \n while replacing with sed/awk?

string="din&esh\nisgood" File.txt: the name is sed "s#\#${string}#g" File.txt Output am getting: the name is dinesh is good Expected output: the name is din&esh\nisgood The input string is dynamic it will be keep on changing am able to handle & by placing \& in the string.. (5 Replies)
Discussion started by: dineshaila
5 Replies
Ace::Model(3pm) 					User Contributed Perl Documentation					   Ace::Model(3pm)

NAME
Ace::Model - Get information about AceDB models SYNOPSIS
use Ace; my $db = Ace->connect(-path=>'/usr/local/acedb/elegans'); my $model = $db->model('Author'); print $model; $name = $model->name; @tags = $model->tags; print "Paper is a valid tag" if $model->valid_tag('Paper'); DESCRIPTION
This class is provided for access to AceDB class models. It provides the model in human-readable form, and does some limited but useful parsing on your behalf. Ace::Model objects are obtained either by calling an Ace database handle's model() method to retrieve the model of a named class, or by calling an Ace::Object's model() method to retrieve the object's particular model. METHODS
new() $model = Ace::Model->new($model_data); This is a constructor intended only for use by Ace and Ace::Object classes. It constructs a new Ace::Model object from the raw string data in models.wrm. name() $name = $model->name; This returns the class name for the model. tags() @tags = $model->tags; This returns a list of all the valid tags in the model. valid_tag() $boolean = $model->valid_tag($tag); This returns true if the given tag is part of the model. path() @path = $model->path($tag) Returns the path to the indicated tag, returning a list of intermediate tags. For example, in the C elegans ?Locus model, the path for 'Compelementation_data" will return the list ('Type','Gene'). asString() print $model->asString; asString() returns the human-readable representation of the model with comments stripped out. Internally this method is called to automatically convert the model into a string when appropriate. You need only to start performing string operations on the model object in order to convert it into a string automatically: print "Paper is unique" if $model=~/Paper ?Paper UNIQUE/; SEE ALSO
Ace AUTHOR
Lincoln Stein <lstein@w3.org> with extensive help from Jean Thierry-Mieg <mieg@kaa.crbm.cnrs-mop.fr> Copyright (c) 1997-1998, Lincoln D. Stein This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2003-06-01 Ace::Model(3pm)
All times are GMT -4. The time now is 08:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy