I want to check the second argument for a specific string .
The code below is what I am trying, but I get:
UX:test (./test): ERROR: { if ($0 ~ /StringImLooking4/) {print $1} }: Unknown operator
I want to test if the second argument contains the string StringImLooking4
Unixware 7
code:
#!/bin/sh
echo $2 > /tmp/temp1
if [ /usr/bin/awk '{ if ($0 ~ /StringImLooking4/) {print $1} }' /tmp/temp1 ]; then
cp -p *.log \SAVE
rm /tmp/temp1
fi