Sponsored Content
Top Forums UNIX for Dummies Questions & Answers GREP function in ksh which ignores LINE Breaks Post 302917981 by Raghav Garg on Friday 19th of September 2014 04:03:07 PM
Old 09-19-2014
GREP function in ksh which ignores LINE Breaks

Hello

I am using a grep command with two patterns in my KSH script. File has line breaks in it and both the patterns are in different lines. Here is the command grep -l 'RITE AID.*ST.820' natriter820u.20140914

Pattern1 - RITE AID
Pattern2 - ST*820

I am not getting any results from this, whereas if I replace this file with a different file having no line breaks then it works. Is there any work around to deal with line breaks here.

Here is the sample data:-

Code:
ISA*00* 00 *ZZ*NATIONSBANK *14*0030020520500 *140918*1200*U*00401*000006436*0*P*^ 
GS*RA*014578892*IGIHCJEEJ*20140918*1200*6442*X*004010
ST*820*000006482 
N1*PR*RITE AID HDQTRS. CORP.*1*014578892

Can someone please help.

Thanks

Last edited by Raghav Garg; 09-19-2014 at 05:19 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep a number from a line in ksh

In file.name, I have a line that reads $IDIR/imgen -usemonths -dropcheck -monitor -sizelimit 80000000 -interval 120 -volcal HSI How can I get the size limit, i.e. 80000000 out and pass it to a variable called SIZE? Thanks. I tried echo "grep sizelimit file.name" | sed -n -e... (3 Replies)
Discussion started by: rodluo
3 Replies

2. Shell Programming and Scripting

any better way to remove line breaks

Hi, I got some log files which print the whole xml message in separate lines: e.g. 2008-10-01 14:21:44,561 INFO do something 2008-10-01 14:21:44,561 INFO print xml : <?xml version="1.0" encoding="UTF-8"?> <a> <b>my data</b> </a> 2008-10-01 14:21:44,563 INFO do something again I want... (3 Replies)
Discussion started by: csmklee
3 Replies

3. Shell Programming and Scripting

Help with wc and line breaks

Hi everyone, I have gone through the forum trying to find an answer to this question but was unsuccessful. I am hoping that someone can help me with this please. I am trying to get my script to recognise line breaks from a file and to give me a result for wc of each line. So basically, if you... (7 Replies)
Discussion started by: stargazerr
7 Replies

4. Shell Programming and Scripting

While read line ignores the '\' in file content

I need to read temp.$i file content line by line through while loop but somehow the '\' do not appear in output.. Can someone guide how to read this exact content line by line in unix : if then cat temp.$i | head -1 # the file content appears fine while... (13 Replies)
Discussion started by: Prev
13 Replies

5. Programming

Clean and keep line breaks

Hello, I want to keep line spaces in comments but clean more then 2 after each. Example: $sentence="This is my first sentence This will be in a new row This will be too in a new row but not separated with 3line breaks just with one "; And i want to... (1 Reply)
Discussion started by: AimyThomas
1 Replies

6. Shell Programming and Scripting

ksh while read loop breaks after one record - AIX

#!/bin/ksh for SRV in imawasp01 \ imawasp02 \ imawasp03 \ imawasp04 \ imawasp05 \ imawasp06 \ imawasp07 \ imawasp08 \ imawasp09 do print "${SRV}" while read PASSLINE do SRVNAME=`echo ${PASSLINE} | awk -F\: '{print $1}'` LASTLOGIN=`ssh ${SRV} lsuser ${SRVNAME} | tr '... (2 Replies)
Discussion started by: port43
2 Replies

7. UNIX for Dummies Questions & Answers

Page breaks and line breaks

Hi All, Need an urgent solution to an issue . We have created a ksh file or shell script which generates 1 DAT file. the DAT file contains extract of a select statement . Now the issue is , when we are executing the ksh file , the output is coimng with page breaks and line breaks . We have... (4 Replies)
Discussion started by: Ayaskant
4 Replies

8. How to Post in the The UNIX and Linux Forums

GREP function in ksh which ignores LINE Breaks

I am using a grep command with two patterns in my KSH script. File has line breaks in it and both the patterns are in different lines. Here is the command - grep -l 'RITE AID.*ST.820' natriter820u.20140914 Pattern1 - RITE AID Pattern2 - ST*820 I am not getting any results from this,... (3 Replies)
Discussion started by: Raghav Garg
3 Replies

9. HP-UX

After using @, line breaks for a particular user in shell

Dear Concern, When we using @ sign, line breaks for a particular user in shell. Please advise how to resolve from the problem in HP UX. tabs@tabsdb02:/ccbs/users/tabs$ cat /etc/passwd|grep tabs tabs:RdCgOsmKee7Ps:221:201::/ccbs/users/tabs:/usr/bin/ksh... (3 Replies)
Discussion started by: makauser
3 Replies

10. Shell Programming and Scripting

[BASH] read 'line' issue with leading tabs and virtual line breaks

Heyas I'm trying to read/display a file its content and put borders around it (tui-cat / tui-cat -t(ypwriter). The typewriter-part is a 'bonus' but still has its own flaws, but thats for later. So in some way, i'm trying to rewrite cat using bash and other commands. But sadly it fails on... (2 Replies)
Discussion started by: sea
2 Replies
L-DEVICES(5)							File Formats Manual						      L-DEVICES(5)

NAME
L-devices - UUCP device description file DESCRIPTION
The L-devices file is consulted by the UUCP daemon uucico(8) under the direction of L.sys(5) for information on the devices that it may use. Each line describes exactly one device. A line in L-devices has the form: Caller Device Call_Unit Class Dialer [Expect Send].... Each item can be separated by any number of blanks or tabs. Lines beginning with a `#' character are comments; long lines can be continued by appending a `' character to the end of the line. Caller denotes the type of connection, and must be one of the following: ACU Automatic call unit, e.g., autodialing modems such as the Hayes Smartmodem 1200 or Novation ``Smart Cat''. DIR Direct connect; hardwired line (usually RS-232) to a remote system. DK AT&T Datakit. MICOM Micom Terminal switch. PAD X.25 PAD connection. PCP GTE Telenet PC Pursuit. SYTEK Sytek high-speed dedicated modem port connection. TCP Berkeley TCP/IP or 3Com UNET connection. These are mutually exclusive. Note that listing TCP connections in L-devices is superflu- ous; uucico does not even bother to look here since it has all the information it needs in L.sys(5). Device is a device file in /dev/ that is opened to use the device. The device file must be owned by UUCP, with access modes of 0600 or bet- ter. (See chmod(2)). Call_Unit is an optional second device file name. True automatic call units use a separate device file for data and for dialing; the Device field specifies the data port, while the Call_unit field specifies the dialing port. If the Call_unit field is unused, it must not be left empty. Insert a dummy entry as a placeholder, such as ``0'' or ``unused.'' Class is an integer number that specifies the line baud (for dialers and direct lines) or the port number (for network connections). The Class may be preceded by a non-numeric prefix. This is to differentiate among devices that have identical Caller and baud, but are distinctly different. For example, ``1200'' could refer to all Bell 212-compatible modems, ``V1200'' to Racal-Vadic modems, and ``C1200'' to CCITT modems, all at 1200 baud. Similarly, ``W1200'' could denote long distance lines, while ``L1200'' could refer to local phone lines. Dialer applies only to ACU devices. This is the "brand" or type of the ACU or modem. DF02 DEC DF02 or DF03 modems. DF112 Dec DF112 modems. Use a Dialer field of DF112T to use tone dialing, or DF112P for pulse dialing. att AT&T 2224 2400 baud modem. cds224 Concord Data Systems 224 2400 baud modem. dn11 DEC DN11 Unibus dialer. hayes Hayes Smartmodem 1200 and compatible autodialing modems. Use a Dialer field of hayestone to use tone dialing, or hayespulse for pulse dialing. It is also permissible to include the letters `T' and `P' in the phone number (in L.sys) to change to tone or pulse midway through dialing. (Note that a leading `T' or `P' will be interpreted as a dialcode!) hayes2400 Hayes Smartmodem 2400 and compatible modems. Use a Dialer field of hayes2400tone to use tone dialing, or hayes2400pulse for pulse dialing. novation Novation ``Smart Cat'' autodialing modem. penril Penril Corp ``Hayes compatible'' modems (they really aren't or they would use the hayes entry.) rvmacs Racal-Vadic 820 dialer with 831 adapter in a MACS configuration. va212 Racal-Vadic 212 autodialing modem. va811s Racal-Vadic 811s dialer with 831 adapter. va820 Racal-Vadic 820 dialer with 831 adapter. vadic Racal-Vadic 3450 and 3451 series autodialing modems. ventel Ventel 212+ autodialing modem. vmacs Racal-Vadic 811 dialer with 831 adapter in a MACS configuration. Expect/Send is an optional Expect/Send script for getting through a smart port selector, or for issuing special commands to the modem. The syntax is identical to that of the Expect/Send script of L.sys. The difference is that the L-devices script is used before the connection is made, while the L.sys script is used after. FILES
/etc/uucp/L-devices /etc/uucp/UUAIDS/L-devices L-devices example SEE ALSO
uucp(1), uux(1), L.sys(5), uucico(8) 4.3 Berkeley Distribution October 22, 1996 L-DEVICES(5)
All times are GMT -4. The time now is 03:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy