The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's manas6 UNIX for Dummies Questions & Answers 0 06-05-2008 06:44 AM
To remove carriage return between the line shash UNIX for Dummies Questions & Answers 5 07-31-2007 12:12 PM
How to insert carriage return before line feed? huey ing Shell Programming and Scripting 2 08-05-2005 01:22 PM
Removing Carriage Return and or line feed from a file tbone231 Shell Programming and Scripting 1 02-18-2005 04:37 PM
carriage return/line feeds pitstop Shell Programming and Scripting 4 11-24-2003 03:47 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-09-2002
Shakey21
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Regex to pick up name from the following including carriage return at end of the line

has anyone got any suggestions how i would pick up the string as part of a substitution inclusive of the carriage return.

ie
i want to pick up <<NAME>> from the PS output but the <<; seems to be on the line before the NAME.

Any ideas are appreciated!

\(\<\).*\(\<\).*\(N\).*\(A\).*\(M\).*\(E\).*\(\>\).*\(\>\)




%%EndFeature
} stopped cleartomark
%%EndSetup
NTPSOct95 begin
%%Page: 1 1
NTPSOct95 /PageSV save put
1 792 translate 72 300 div dup neg scale
0 0 transform .25 add round .25 sub exch .25 add round .25 sub exch itransform translate
%%IncludeFont: Times-Roman
[50 0 0 -50 0 0]/Times-Roman MF
(T)371 345 MS (e)402 345 MS (s)424 345 MS (t)443 345 MS ( )458 345 MS (p)471 345 MS (s)496 345 MS ( )515 345 MS (f)528 345 MS (i)543 345 MS (l)555 345 MS (e)567 345 MS ( )589 345 MS (w)602 345 MS (i)638 345 MS (t)650 345 MS
(h)665 345 MS ( )689 345 MS (a)702 345 MS ( )724 345 MS ( )737 345 MS (s)750 345 MS (p)769 345 MS (e)794 345 MS (c)816 345 MS (i)838 345 MS (a)850 345 MS (l)872 345 MS ( )884 345 MS (f)897 345 MS (i)912 345 MS (e)924 345 MS
(l)946 345 MS (d)958 345 MS ( )983 345 MS (t)996 345 MS (o)1011 345 MS ( )1037 345 MS (p)1050 345 MS (a)1075 345 MS (r)1097 345 MS (s)1114 345 MS (e)1133 345 MS ( )1155 345 MS (a)1168 345 MS ( )1190 345 MS (<)1203 345 MS (<)1231 345 MS
(N)1259 345 MS (A)1295 345 MS (M)1330 345 MS (E)1374 345 MS (>)1405 345 MS (>)1433 345 MS ( )1461 345 MS (t)1474 345 MS (o)1489 345 MS (.)1515 345 MS
( )1528 345 MS
PageSV restore
showpage
  #2 (permalink)  
Old 07-17-2002
mslightn mslightn is offline
Registered User
  
 

Join Date: Jul 2002
Posts: 24
Lightbulb

(<ps file output> | <the_sed_command_below...>)

sed '
:loop
$!{
/<<$/{N; s|<<\nNAME>>| **something** |;}
/\\$/t loop
}'

This can be improved upon, but this should get you started.
  #3 (permalink)  
Old 07-17-2002
peter.herlihy peter.herlihy is offline
Registered User
  
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
From the look of your data - you'd need a number of commands....becasue the <<NAME>> could be line broken at any point across the field....is this so?

<
<NAME>>

or

<<
NAME>>

or

<<N
AME>>

etc.....
  #4 (permalink)  
Old 07-18-2002
mslightn mslightn is offline
Registered User
  
 

Join Date: Jul 2002
Posts: 24
Lightbulb

According to the code above, this should be

<<
NAME>>

BUT... as a catch all <w/ corrections ... my bad!>

sed '
$!{ /<<*N*A*M*E*>*$/N; }
s/<\n*<\n*N\n*A\n*M\n*E\n*>\n*>/ **something** /;
'
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 01:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0