
18th May 2006, 00:53
|
|
Pseudo Lawyer
|
|
Join Date: Apr 2006
Location: Switzerland
Posts: 857
Thanks: 3
Thanked 25 Times in 23 Posts
|
|
Bash: Assigning variables
Hiya
I have a little code snippet like this:
Code:
LINK=`/bin/grep -f http://www.spamcop.net/sc?id= $FILENAME`
echo $LINK
LINK=`/bin/fgrep http://www.spamcop.net/sc?id= $FILENAME`
echo $LINK
LINK=`/bin/ls $FILENAME`
echo $LINK
The output is this:
Code:
grep: http://www.spamcop.net/sc?id=: No such file or directory
/bin/fgrep: line 2: exec: grep: not found
1147891663.9720_2.t390.greatnet.de:2,ST
grep: http://www.spamcop.net/sc?id=: No such file or directory
/bin/fgrep: line 2: exec: grep: not found
1147896741.16696_2.t390.greatnet.de:2,ST
Why do grep and fgrep not work but the ls does?
|

18th May 2006, 21:41
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,853
Thanks: 781
Thanked 1,558 Times in 1,477 Posts
|
|
I don't think you can use grep for files that aren't on the same system.
|

18th May 2006, 22:10
|
|
Pseudo Lawyer
|
|
Join Date: Apr 2006
Location: Switzerland
Posts: 857
Thanks: 3
Thanked 25 Times in 23 Posts
|
|
They are on the same system but I have to use grep -F and not grep -f ^^
But I still wonder why fgrep does not work...
|

19th May 2006, 16:30
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,853
Thanks: 781
Thanked 1,558 Times in 1,477 Posts
|
|
But you can't use grep with URLs, no matter if they point to the same system.
|

19th May 2006, 16:35
|
|
Pseudo Lawyer
|
|
Join Date: Apr 2006
Location: Switzerland
Posts: 857
Thanks: 3
Thanked 25 Times in 23 Posts
|
|
Not sure what you mean. The shell script looks like this now:
Code:
#!/bin/bash
# ENTER PATH OF THE VERIFICATION EMAILS FROM SPAMCOP
PATH="/home/mail/web4p1/Maildir/.Spamcop-Reply/cur"
# ENTER WEBPATH TO PHP SCRIPT
URL="http://www.roleplayer.org/spamcop.php"
#################################################################
#################################################################
cd $PATH
for FILENAME in *S
do
LINK=`/bin/grep -F http://www.spamcop.net/sc?id= $FILENAME`
echo $LINK
# LINK=`/bin/fgrep http://www.spamcop.net/sc?id= $FILENAME`
# echo $LINK
# LINK=`/bin/ls $FILENAME`
# echo $LINK
# lynx -dump $URL?link=$LINK
# /bin/rm $FILENAME
done
|

21st May 2006, 22:45
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,853
Thanks: 781
Thanked 1,558 Times in 1,477 Posts
|
|
You can use grep with local files, e.g.
Code:
grep bla /path/to/example.txt
, but not with URLs, like
Code:
grep bla http://www.example.com/example.txt
|

22nd May 2006, 21:07
|
|
Junior Member
|
|
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You could use wget to download the file then pipe it into grep.
Code:
wget -q -O - "http://www.example.com/example.txt" | grep bla
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 22:05.
|
Recent comments
13 hours 33 min ago
18 hours 49 min ago
19 hours 13 sec ago
19 hours 8 min ago
20 hours 10 min ago
22 hours 17 min ago
1 day 42 min ago
1 day 1 hour ago
1 day 1 hour ago
1 day 2 hours ago