Sponsored Content
Top Forums Shell Programming and Scripting Regex to pick up name from the following including carriage return at end of the line Post 24246 by Shakey21 on Tuesday 9th of July 2002 02:38:18 AM
Old 07-09-2002
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
Shakey21
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

carriage return/line feeds

Hello, I have a file that has got carriage returns in it and I want to take them out. Anyone know how I can do this in a ksh? thanks (4 Replies)
Discussion started by: pitstop
4 Replies

2. UNIX for Dummies Questions & Answers

Remove a carriage return at end of variable

Is there a command in unix to remove a carriage return character(^M) at the end of a variable value? (5 Replies)
Discussion started by: flagship99
5 Replies

3. Shell Programming and Scripting

Carriage Return at end of file

Hi, I have a script that outputs a file that contains the dates from the previous month, which is then used by our application to run processes on each date contained in the file. My problem is is that my script created a blank line at the bottom of the file which causes issues for our... (14 Replies)
Discussion started by: bd_joy
14 Replies

4. UNIX for Dummies Questions & Answers

To remove carriage return between the line

Hi, I have a situation where I need to remove the carriage return between the lines. For.eg. The input file: 1,ad,"adc sdfd",edf 2,asd,"def fde",asd The output file should be 1,ad,adc sdfd,edf 2,asd,def fde,asd Thanks Shash (5 Replies)
Discussion started by: shash
5 Replies

5. Shell Programming and Scripting

add carriage return at end of file

Hi I would like to add carriage return at end of file, because we need to mask the customer names for detailed records. Some what the file doesnot have carriage at end of line of last record.So that i 'll get 2 records when use ---aa.txt----- 1|aaa|bbb|ccc 2|bbbb|hghgh|ggg 000002 tail... (2 Replies)
Discussion started by: HAA
2 Replies

6. UNIX for Advanced & Expert Users

Padding Carriage return to the end of XML file

Hi All, I am getting a xml file where the first field contains a carriage return and the all other fields doesnot contains any carriage return. So all the other records comes in the second line. <?xml version="1.0" encoding="UTF-8"?> <ns0:iSeriesCspIntegration... (3 Replies)
Discussion started by: dasj22
3 Replies

7. Shell Programming and Scripting

Insert a line including Variable & Carriage Return / sed command as Variable

I want to instert Category:XXXXX into the 2. line something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong: sed "2i\\${n}Category:$cat\n" Sample: Titel Blahh Blahh abllk sdhsd sjdhf Blahh Blah Blahh Blahh Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies

8. Shell Programming and Scripting

Need a carriage return at end of each line

Hi All, I am reading two files and writing out the file name and count of lines in each file to an output file. My script looks like this: echo "input_file1.out;`wc -l < input_file1.out | sed 's/^]*\(.*\)]*$/\1/'` " > comp_file1.out echo "input_file2.out;`wc -l < input_file2.out | sed... (2 Replies)
Discussion started by: Hangman2
2 Replies

9. Shell Programming and Scripting

A variable is including the Carriage Return char...

Hi all, I'm reading a file with this layout: First_Col Second_Col The Second_Col has values as 1000, -1, 10, 43... While reading the file I'm getting the second column value with awk command, but it is including the CR control char. do item_saved=`echo $b | awk '{print... (4 Replies)
Discussion started by: mrreds
4 Replies

10. Shell Programming and Scripting

line carriage return characters

Hi, I would like to insert the line carriage retrun characters on each line. (2 Replies)
Discussion started by: koti_rama
2 Replies
PICK(1) 							     [nmh-1.5]								   PICK(1)

NAME
pick - search for messages by content SYNOPSIS
pick [+folder] [msgs] [-and ...] [-or ...] [-not ...] [-lbrace ... -rbrace] [--component pattern] [-cc pattern] [-date pattern] [-from pattern] [-search pattern] [-subject pattern] [-to pattern] [-after date] [-before date] [-datefield field] [-sequence name ...] [-public | -nopublic] [-zero | -nozero] [-list | -nolist] [-version] [-help] typical usage: scan `pick -from jones` pick -to holloway -sequence select show `pick -before friday` DESCRIPTION
Pick searches within a folder for messages with the specified contents, and then identifies those messages. Two types of search primitives are available: pattern matching and date constraint operations. A modified grep(1) is used to perform the matching, so the full regular expression (see ed(1)) facility is available within pattern. With -search, pattern is used directly, and with the others, the grep pattern constructed is: `component[ ]*:.*pattern' This means that the pattern specified for a -search will be found everywhere in the message, including the header and the body, while the other pattern matching requests are limited to the single specified component. The expression `--component pattern' is a shorthand for specifying `-search "component[ ]*:.*pattern" ' It is used to pick a component which is not one of "To:", "cc:", "Date:", "From:", or "Subject:". An example is "pick --reply-to pooh". Pattern matching is performed on a per-line basis. Within the header of the message, each component is treated as one long line, but in the body, each line is separate. Lower-case letters in the search pattern will match either lower or upper case in the message, while upper case will match only upper case. Note that since the -date switch is a pattern matching operation (as described above), to find messages sent on a certain date the pattern string must match the text of the "Date:" field of the message. Independent of any pattern matching operations requested, the switches -after date or -before date may also be used to introduce date/time constraints on all of the messages. By default, the "Date:" field is consulted, but if another date yielding field (such as "BB-Posted:" or "Delivery-Date:") should be used, the -datefield field switch may be used. With -before and -after, pick will actually parse the date fields in each of the messages specified in `msgs' and compare them to the date/time specified. If -after is given, then only those messages whose "Date:" field value is chronologically after the date specified will be considered. The -before switch specifies the complimentary action. Both the -after and -before switches take legal 822-style date specifications as arguments. Pick will default certain missing fields so that the entire date need not be specified. These fields are (in order of defaulting): timezone, time and timezone, date, date and time- zone. All defaults are taken from the current date, time, and timezone. In addition to 822-style dates, pick will also recognize any of the days of the week ("sunday", "monday", and so on), and the special dates "today", "yesterday" (24 hours ago), and "tomorrow" (24 hours from now). All days of the week are judged to refer to a day in the past (e.g., telling pick "saturday" on a "tuesday" means "last saturday" not "this saturday"). Finally, in addition to these special specifications, pick will also honor a specification of the form "-dd", which means "dd days ago". Pick supports complex boolean operations on the searching primitives with the -and, -or, -not, and -lbrace ... -rbrace switches. For example, pick -after yesterday -and -lbrace -from freida -or -from fear -rbrace identifies messages recently sent by "frieda" or "fear". The matching primitives take precedence over the -not switch, which in turn takes precedence over -and which in turn takes precedence over -or. To override the default precedence, the -lbrace and -rbrace switches are provided, which act just like opening and closing parenthe- ses in logical expressions. If no search criteria are given, all the messages specified on the command line are selected (this defaults to "all"). Once the search has been performed, if the -list switch is given, the message numbers of the selected messages are written to the standard output separated by newlines. This is extremely useful for quickly generating arguments for other nmh programs by using the "backquoting" syntax of the shell. For example, the command scan `pick +todo -after "31 Mar 83 0123 PST"` says to scan those messages in the indicated folder which meet the appropriate criterion. Note that since pick's context changes are writ- ten out prior to scan's invocation, you need not give the folder argument to scan as well. The -sequence name switch may be given once for each sequence the user wishes to define. For each sequence named, that sequence will be defined to mean exactly those messages selected by pick. For example, pick -from frated -seq fred defines a new message sequence for the current folder called "fred" which contains exactly those messages that were selected. By default, pick will zero the sequence before adding it. This action can be disabled with the -nozero switch, which means that the mes- sages selected by pick will be added to the sequence, if it already exists, and any messages already a part of that sequence will remain so. The -public and -nopublic switches are used by pick in the same way mark uses them. FILES
$HOME/.mh_profile The user profile PROFILE COMPONENTS
Path: To determine the user's nmh directory Current-Folder: To find the default current folder SEE ALSO
mark(1) DEFAULTS
`+folder' defaults to the current folder `msgs' defaults to all `-datefield date' `-zero' `-list' is the default if no `-sequence', `-nolist' otherwise CONTEXT
If a folder is given, it will become the current folder. HISTORY
In previous versions of MH, the pick command would show, scan, or refile the selected messages. This was rather "inverted logic" from the UNIX point of view, so pick was changed to define sequences and output those sequences. Hence, pick can be used to generate the arguments for all other MH commands, instead of giving pick endless switches for invoking those commands itself. Also, previous versions of pick balked if you didn't specify a search string or a date/time constraint. The current version does not, and merely matches the messages you specify. This lets you type something like: show `pick last:20 -seq fear` instead of typing mark -add -nozero -seq fear last:20 show fear Finally, timezones used to be ignored when comparing dates: they aren't any more. HELPFUL HINTS
Use "pick sequence -list" to enumerate the messages in a sequence (such as for use by a shell script). BUGS
The argument to the -after and -before switches must be interpreted as a single token by the shell that invokes pick. Therefore, one must usually place the argument to this switch inside quotes. Furthermore, any occurrence of -datefield must occur prior to the -after or -before switch it applies to. If pick is used in a back-quoted operation, such as scan `pick -from jones` and pick selects no messages (e.g., no messages are from "jones"), then the shell will still run the outer command (e.g., scan). Since no messages were matched, pick produced no output, and the argument given to the outer command as a result of backquoting pick is empty. In the case of nmh programs, the outer command now acts as if the default `msg' or `msgs' should be used (e.g., "all" in the case of scan). To prevent this unexpected behavior, if -list was given, and if its standard output is not a tty, then pick outputs the illegal message number "0" when it fails. This lets the outer command fail gracefully as well. The pattern syntax "[l-r]" is not supported; each letter to be matched must be included within the square brackets. MH.6.8 11 June 2012 PICK(1)
All times are GMT -4. The time now is 04:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy