Thanks for all your answers!
I settled for the simplest of them all, by single quoting the shell
variables:
> perl -wne 'if (/'$FILENAME'/) { s/\d{4}-\d{2}-\d{2}/'$UPDATED'/;print;
> }' updated_files.txt
The reason I use bash here and not only good old perl is that the bash
script is much bigger
Hi!
I have a problem with variables when using command-line perl in a bash
script. The script should update a date (in 2003-10-10 form) if the
argument, which is a file name, exists on the same line in the file
updated_files.txt.
#!/bin/bash
FILENAME=$1
UPDATED=`date +%F`
echo
echo "perl -wne 'i
> lt, gt etc. are used for string comparisons. Change 'lt' to < and 'gt' to >
> and your code should work.
>
You're right, but this script was a simplification of a bigger one where
'>' didn't work (my mistake to not spot the difference...). Here is a
more 'real' situation:
Input file:
4635a
Hi there,
I have a simple problem that I'm sure has been asked before (so why not
again ;))
I have a list like this:
1e-100
2e-100
1e-45
5e-10
1
10
20
and want to make correct assignments:
1e-100 SMALL
2e-100 SMALL
1e-45 BIGGER
5e-10 BIGGER
1 BIGGER
10 BIG
20 BIG
But wit
Homework's sorted ;)! Thanks a lot Thomas, it worked fine!
Marcus
On Thu, 2003-09-18 at 10:41, Thomas Bätzler wrote:
> Marcus Claesson [mailto:[EMAIL PROTECTED] asked:
> > I have a silly little list-parsing problem that I can't get my head
> > around, and I'm sure s
cus
>
> Just look at the perldoc perlreftut. What you are looking for is the exact
> exemple of the paper.
>
> Michel
>
>
> -----Message d'origine-
> De: Marcus Claesson [mailto:[EMAIL PROTECTED]
> Date: jeudi 18 septembre 2003 11:26
> : [EMAIL PROTECTED]
Hi People,
I have a silly little list-parsing problem that I can't get my head
around, and I'm sure some of you have come across it before.
I have a list like this:
1 a
2 b
2 c
3 a
4 d
4 d
4 e
4 f
5 g
and I want to make the first column non-