Sponsored Content
Full Discussion: pattern matching problem
Top Forums Shell Programming and Scripting pattern matching problem Post 302142440 by rein on Friday 26th of October 2007 07:29:47 AM
Old 10-26-2007
pattern matching problem

I have a file with the following contents;

NEW 85174 MP081 /29OCT07
CNL 85986 MP098 /28OCT07
NEW 86014 MP098 /28OCT07
NEW 86051 MP097 /27OCT07
CNL 86084 MP097 /27OCT07


Now I have to retrieve all lines that start with NEW and where the next line starts with CNL and where the MP codes are the same in both lines.

So it has to return the last two lines from this example.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem with CASE pattern matching

I am using ksh on a HP Ux. I have a simple script but am having problem with the case statement:- #!/usr/bin/sh Chl=”SM.APPLE_SWIFT_DV” LoConfirm=”” case $chl in ) LoConfirm=”Using channel at Building 1” echo “test conditon1” echo $LoConfirm;; ) LoConfirm=”Using... (2 Replies)
Discussion started by: gummysweets
2 Replies

2. Shell Programming and Scripting

pattern matching problem

FilesToBackup='*.track* *.xml *.vm* *.gz Trace* TRACE* "*core*" *.out fcif_data_* esi_error_* *.rollback *.sed R.* APStatus_* log* *.output* send_mail* downenv* check_env* intaspurge_db_* sqlnet.log *.rpt *.html *.csv "*TSC*"' and i am using it like this- echo Moving files from $(pwd): ... (2 Replies)
Discussion started by: namishtiwari
2 Replies

3. Shell Programming and Scripting

Pattern Matching problem in UNIX

Hello All, I need help I have a problem in searching the pattern in a file let us say the file contains the below lines line 1 USING *'/FILE/FOLDER/RETURN') ................. ................. line 4 USING *'/FILE/FOLDER/6kdat1') line 5 USING... (2 Replies)
Discussion started by: maxmave
2 Replies

4. Shell Programming and Scripting

problem using sed for pattern matching

if abc.sh is 192.168.1.41 then the output that i get is v5c01 my code is sed 's/192.168.1.4/v5c0/g s/192.168.1.41/acc1/g' abc.sh 2>&1 | tee abc.sh i want to find 192.168.1.4 and replace it with v5c0 and find 192.168.1.41 and replace it with acc1 and i want to do it using sed (5 Replies)
Discussion started by: lassimanji
5 Replies

5. Shell Programming and Scripting

Problem extracting just a part of a matching pattern

Hello everyone, this is my first post so please give me a hand. I apologize for my English, I'll try to be clear with my request. I need to write a script (Bash) which finds all the variables defined in the file .h of the folder and then writes the name of the files .c where these variables are... (1 Reply)
Discussion started by: paxilpaz
1 Replies

6. Shell Programming and Scripting

pattern matching problem

# cat email.txt | grep -i "To:" To: <test@example.com> # cat email.txt | grep -i "Subject" Subject: Test Subject: How are you. I need to print only test@example.com from To field need to eliminate "< & >" from To field and need to print entire subject after Subject: It should be #... (7 Replies)
Discussion started by: mirfan
7 Replies

7. Programming

pl sql . pattern matching problem

hi everyone i am facing a strange problem declare v_var number(10); begin if( regexp_like('RCDORMS_MMS_*_DAR','RCDORMS_MMS_*_DAR')) then v_var:=20; dbms_output.put_line(v_var); end if; end; / please tell me what's the wrong thing in this expression.. as i am not able to get... (1 Reply)
Discussion started by: aishsimplesweet
1 Replies

8. Shell Programming and Scripting

Pattern matching and format problem

Hi I need a bash script that can search through a text file and when it finds 'FSS1206' I need to put a Letter F 100 spaces after the second instance of FSS1206 The format is the same throughout the file I need to repeat this on every time it finds the second 'FSS1206' in the file I have... (3 Replies)
Discussion started by: firefox2k2
3 Replies

9. Shell Programming and Scripting

Pattern matching problem

Hi I need a bash script that can search through a text file for all lines starting with 71502FSC1206 on every line it finds starting with this I need to place a letter F at the 127 position on that line. Thanks Paul (6 Replies)
Discussion started by: firefox2k2
6 Replies

10. Shell Programming and Scripting

Pattern matching problem

if i have to do pattern match for file name with digit alphanumeric value like this File_1234.csv File_12sd45rg.csv i am using this File_*.csv and File_*.csv for digit pattern match. when i am doing pattern match for the digit then both alphanumeric match and digit match is coming. ... (3 Replies)
Discussion started by: ramsavi
3 Replies
SCREEN(4)						   BSD Kernel Interfaces Manual 						 SCREEN(4)

NAME
screen -- pc display interface DESCRIPTION
Access to the virtual consoles are obtained through the device files /dev/ttyv0 - /dev/ttyvb. Each of these files correspond to a separate virtual console. All virtual console devices can be open at once, but only one is active at a time. The active virtual console "owns" the keyboard and display screen. Output to a virtual console that not currently is on the display is saved in a buffer that holds a "screenfull" (normally 25) lines. Any output written to /dev/console (the original console device) is echoed to /dev/ttyv0. To switch between the virtual consoles one uses the sequence ALT+Fn, which means hold down ALT and press one of the function keys. The vir- tual console with the same number as the function key is then selected as the current virtual console, and given exclusive use of the key- board and display. This switch sequence can be changed via the keyboard mapping ioctl call (see keyboard(4)). The console allows entering values that are not physically present on the keyboard via a special keysequence. To use this facility press and hold down ALT, then enter a decimal number from 0-255 via the numerical keypad, then release ALT. The entered value is then used as the ASCII value for one character. This way it is possible to enter any ASCII value. The console driver also includes a history function. It is activated by pressing the scroll-lock key. This holds the display, and enables the cursor arrows for scrolling up and down through the last scrolled out lines. The console understands a subset of the ANSI x3.64 character sequences. For compatibility with the old pccons, the PC3 character sequences are also supported. ANSI Seq Function Termcap entry ======= ======= ===================================== ============== -- E7 Save cursor position sc -- E8 Restore saved cursor position rc -- Ec Reset rs -- EM move cursor up 1 line, -- scroll if at top CUU E[nA move cursor up n lines up/UP (ku) CUD E[nB move cursor down n lines do/DO (kd) CUF E[nC move cursor right n characters nd/RI (kr) CUB E[nD move cursor left n characters --/LE (kl) HPA E[n` move cursor to character position n ch HPR E[na move cursor right n characters -- VPA E[nd move cursor to line n cv VPR E[ne move cursor down n lines -- CPL E[nF move cursor to start of line, -- (@7) n lines up CNL E[nE move cursor to start of line, nw n lines down CUP E[y;xH Move cursor to x, y cm HVP E[y;xf Move cursor to x, y -- CBT E[nZ Move cursor back n tab stops bt (kB) IL E[nL Insert n blank lines al/AL ICH E[n@ Insert n blank characters ic/IC DL E[nM Delete n lines dl/DL DCH E[nP Delete n characters dc/DC ED E[nJ Erase part or all of display: cd n=0 from cursor to end of display, n=1 from begin of display to cursor, n=2 entire display. EL E[nK Erase part or all of line: ce n=0 from cursor to end of line, n=1 from begin of line to cursor, n=2 entire line. ECH E[nX Erase n characters ec SU E[nS Scroll display n lines up (forward) sf/SF SD E[nT Scroll display n lines down (reverse) sr/SR SGR E[nm Set character attributes: -- n= 0 normal attribute (all off) n= 1 bold (highlight) n= 4 underscore (if supported by HW) n= 5 blink (if supported by HW) n= 7 reverse n= 22 remove bold n= 24 remove underscore n= 25 remove blink n= 27 remove reverse n= 3X set ANSI foreground color (see table) n= 4X set ANSI background color (see table) X=0 black X=1 red X=2 green X=3 brown X=4 blue X=5 magenta X=6 cyan X=7 light grey X=9 reset to the normal color -- E[s Save cursor position sc -- E[u Restore saved cursor position rc -- E[x Reset normal colors and attributes -- to their default values -- E[nz Switch to virtual console n -- -- E[1;nx Set normal ANSI background color -- to n (see table) -- E[2;nx Set normal ANSI foreground color -- to n (see table) -- E[3;nx Set normal video attribute directly -- to n (n from 0 to 255) -- E[5;nx Set normal ANSI reverse background -- color to n (see table) -- E[6;nx Set normal ANSI reverse foreground -- color to n (see table) n= 0 black n= 8 dark grey n= 1 red n= 9 light red n= 2 green n=10 light green n= 3 brown n=11 yellow n= 4 blue n=12 light blue n= 5 magenta n=13 light magenta n= 6 cyan n=14 light cyan n= 7 light grey n=15 white -- E[7;nx Set normal reverse video attribute -- directly to n (n from 0 to 255) -- E[=p;dB Set bell pitch (p) and duration (d), -- pitch is in units of 840 nS, duration is units of 0,1 S. -- E[=tC Set global cursor type (see table) -- t=0 normal non-blinking t=1 normal blinking t=2 custom non-blinking t=3 custom blinking t=4 reset cursor (resets custom cursor shape and sets current cursor type to 0) t=5 hide cursor -- E[=s;eC Set custom cursor shape, where -- s is the starting and e is the ending scanlines of the cursor. -- E[=s;e;dC -- Same as above, except d specifies the direction. If 0, scanlines are counted from the top to the bottom. If 1, from the bottom to the top. -- E[=tS Set local cursor type (see table) -- t=0 normal (global) ve t=1 invisible vi t=2 very visible vs -- E[=nA Set the border color to n -- (see table) (if supported by HW) -- E[=nF Set normal foreground color to n -- (see table) -- E[=nG Set normal background color to n -- (see table) -- E[=nH Set normal reverse foreground color -- to n (see table) -- E[=nI Set normal reverse background color -- to n (see table) n= 0 black n= 8 dark grey n= 1 blue n= 9 light blue n= 2 green n=10 light green n= 3 cyan n=11 light cyan n= 4 red n=12 light red n= 5 magenta n=13 light magenta n= 6 brown n=14 yellow n= 7 light grey n=15 white note: the first E in the sequences stands for ESC (0x1b) AUTHORS
Soren Schmidt <sos@FreeBSD.org> BSD
October 6, 2000 BSD
All times are GMT -4. The time now is 05:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy