problem with grep on aix
Hi..
I am facing a strange problem on AIX with ksh scripting. The problem is with grep command. It's not able to work in the below code. Code:
#!/bin/ksh Code:
1_rrc_attribute.csv Thanks and regards, |
Maybe the AIX version of grep or ksh doesn't like the quotes around the variable?
Code:
grep "${PROP_KEY}" PROP_KEY=test echo $PROP_KEY echo ${PROP_KEY} echo "${PROP_KEY}" Typically I only use double quotes with egrep (a/k/a grep -E). Maybe the AIX version doesn't expect the quotes for standard grep. If so maybe use egrep (or grep -E) with the quotes works? |
I also used without the quotes but nothing works. Lemme try above one will let you know
|
using
echo $PROP_KEY echo ${PROP_KEY} echo "${PROP_KEY}" its giving the same output...:( correct prop_key name |
Quote:
|
Ok it must be something the shell is doing.
I noticed you're doing a cat of file and piping to grep - this isn't necessary - you can just grep the file. What happens if you change: Code:
RowCount_from_prop=$(cat ${FILE_NAME} | grep "${PROP_KEY}" | cut -d'=' -f2 | tr -d '\r') Code:
RowCount_from_prop=$(grep "${PROP_KEY}" ${FILE_NAME} | cut -d'=' -f2 | tr -d '\r') |
Quote:
Code:
#!/usr/bin/ksh Now whats the problem it has with same grep command in other script. Any solutions?? :( |
Thanks all for your support.. Solved the problem. it was with the input text file.:)
Thanks & Regards, |
All times are GMT -5. The time now is 09:44 PM. |