Sponsored Content
Operating Systems AIX AIX 4.2 Korn shell and grep question Post 302256883 by Browser_ice on Monday 10th of November 2008 08:26:19 PM
Old 11-10-2008
Quote:
Originally Posted by bakunin
Ok, i retried it on AIX - same result as in Cygwin:

Code:
bakunin@aix_5_2:/tmp> cat test.asc
x(xx,x,x,,,x,x,9999,,x,,,xx,,,xxxx,,,,,,,,,,,,,,,,,,999,
x(xx,x,x,,,x,x,8888,,x,,,xx,,,xxxx,,,,,,,,,,,,,,,,,,999,
bakunin@aix_5_2:/tmp> grep "^\([^,]*,\)\{7\}9999" test.asc
x(xx,x,x,,,x,x,9999,,x,,,xx,,,xxxx,,,,,,,,,,,,,,,,,,999,
bakunin@aix_5_2:/tmp> grep "^\([^,]*,\)\{7\}8888" test.asc
x(xx,x,x,,,x,x,8888,,x,,,xx,,,xxxx,,,,,,,,,,,,,,,,,,999,
bakunin@aix_5_2:/tmp> grep "^\([^,]*,\)\{33\}999" test.asc
x(xx,x,x,,,x,x,9999,,x,,,xx,,,xxxx,,,,,,,,,,,,,,,,,,999,
x(xx,x,x,,,x,x,8888,,x,,,xx,,,xxxx,,,,,,,,,,,,,,,,,,999,
bakunin@aix_5_2:/tmp> what /usr/bin/grep
/usr/bin/grep:
        61      1.14  src/bos/usr/ccs/lib/libc/__threads_init.c, libcthrd, bos520 7/11/00 12:04:14
        46      1.72.2.3  src/bos/usr/bin/grep/grep.c, cmdscan, bos52L, l2005_19B0 4/14/05 04:52:19

I could test with other versions of AIX, but i suppose there would be no difference. Is in your data any non-printing character or something like that? have you tried the command outside of the script? Maybe its one of these "obvious" yet hard to find things one tends to think about always last.

I hope this helps.

bakunin
There are no non-printing characters and I did those tests on the command line.

I did a what /usr/bin/grep and got (typed it as no way of copy/paste):
46 1.59 src/bos/usr/bin/grep/grep.c, cmdscan, box420, 9613T 12/19/95 08:22:09
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question about Korn Shell

In Korn Shell, can you use "go to" statements? Would you then put paragraph names with a colon? For example, would you specify "goto para1" and then have the paragraph with the label para1:? I am getting an error message when Idid this. I have my paragraph name 'clsbooks:' and I get... (13 Replies)
Discussion started by: Latha Nair
13 Replies

2. Shell Programming and Scripting

AWK question in the KORN shell

Hi, I have two files with the following content: gmrd.txt 235649;03;2563;598 291802;00;2563;598 314634;00;235649;598 235649;03;2563;598 393692;00;2563;598 411805;00;2563;598 411805;00;2563;598 235649;03;2563;598 414037;00;2563;598 575200;00;2563;598 70710;00;2563;598... (11 Replies)
Discussion started by: penfold
11 Replies

3. Shell Programming and Scripting

Korn Shell Loop question

I'm needing help with assigning variables inside a while loop of ksh script. I have an input text file and ksh script below and I'm trying to create a script which will read the input file line by line, assign first and second word to variables and process the variables according to the contents. ... (4 Replies)
Discussion started by: stevefox
4 Replies

4. Shell Programming and Scripting

korn shell question

Hi all, I am trying to tweak my ksh , i am running V: Version M-11/16/88i I have my Backspace and up/down arrows working using the following code in my ~/.profile file. set -o emacs alias __A=$(print '\020' ) alias __B=$(print '\016' ) alias __C=$(print '\006' ) alias __D=$(print... (4 Replies)
Discussion started by: mich_elle
4 Replies

5. Shell Programming and Scripting

Korn shell and awk question

I am modifying a Korn shell script in using the Exceed (Solaris 10 environment). My task is to read in a .txt file with dates arranged like this (01-Sep-2006). I am to read each line and take the dates, compare them to a benchmark date and depending on if it is older than the date or the date and... (6 Replies)
Discussion started by: mastachef
6 Replies

6. Shell Programming and Scripting

AIX Korn shell sed -s problem

In a Korn shell script I have, cat ../header | sed -e 's/flag1/$cnumb/g' > header.txt The header is short {{Company flag1}} But the result in header.txt is {{Company $cnumb}} The value of $cnumb is 120. I am trying to get the value of $cnumb into the header. I have tried /'$cnumb'/g,... (10 Replies)
Discussion started by: jcarrott
10 Replies

7. Shell Programming and Scripting

Korn Shell programming (FTP, LOOPS, GREP)

Hello All, I have another Korn shell question. I am writing a script that will ftp a file from my production database to my test database. To this, I have to construct a loop that checks a specified folder for a file. If the file exists, I want it execute the ftp protocol and then exit. ... (2 Replies)
Discussion started by: jonesdk5
2 Replies

8. UNIX for Dummies Questions & Answers

List of 'if -f' options - AIX / Korn Shell

Hi all, Can someone point me in the right direction for a manual on the various statement options for 'if'. Basically I have a piece of code which says: if ] and I wondered what the -f was. I know the '!' means not equal.. As usual any help much appreciated.. (5 Replies)
Discussion started by: Grueben
5 Replies

9. Shell Programming and Scripting

Korn shell behaviour in AIX

Hi, Consider the code snippet below: fun() { while read x do echo $x done < somefile_that_does_not_exists } fun echo I am here Korn shell on HPUX prints the message "I am here", while the behaviour is different on AIX korn shell. We do not get the message on AIX. Any... (5 Replies)
Discussion started by: 116@434
5 Replies

10. Shell Programming and Scripting

Help when using Typeset in AIX Korn Shell

Guys, please help! I am currently using an AIX server however whenever I tried to use the typeset -F3, the variable is resulting with a "#". In the given example below, I declared x to be a decimal holding 3 decimal places = 1.455. However whenever I tried to echo the $x, the resulting value... (9 Replies)
Discussion started by: zzavilz
9 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep is used to invoke the grep on compress'ed or gzip'ed files. All options specified are passed directly to grep. If no file is speci- fied, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If zgrep is invoked as zegrep or zfgrep then egrep or fgrep is used instead of grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. For example: for sh: GREP=fgrep zgrep string files for csh: (setenv GREP fgrep; zgrep string files) AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), egrep(1), fgrep(1), zdiff(1), zmore(1), znew(1), zforce(1), gzip(1), gzexe(1) ZGREP(1)
All times are GMT -4. The time now is 11:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy