shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



>From address@hidden Tue Jul 06 12:32:48 2004
Return-Path: <address@hidden>
X-Sender: address@hidden
X-Apparently-To: address@hidden
Received: (qmail 86074 invoked from network); 6 Jul 2004 19:32:46 -0000
Received: from unknown (66.218.66.217)
  by m4.grp.scd.yahoo.com with QMQP; 6 Jul 2004 19:32:46 -0000
Received: from unknown (HELO n13.grp.scd.yahoo.com) (66.218.66.68)
  by mta2.grp.scd.yahoo.com with SMTP; 6 Jul 2004 19:32:46 -0000
Received: from [66.218.66.128] by n13.grp.scd.yahoo.com with NNFMP; 06 Jul 2004 
19:32:31 -0000
Date: Tue, 06 Jul 2004 19:32:31 -0000
To: address@hidden
Message-ID: <address@hidden>
User-Agent: eGroups-EW/0.82
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Length: 1514
X-Mailer: Yahoo Groups Message Poster
X-eGroups-Remote-IP: 66.218.66.68
From: "fpasa" <address@hidden>
X-Originating-IP: 200.96.99.194
Subject: Problema com awk
X-Yahoo-Group-Post: member; u=188951957
X-Yahoo-Profile: fpasa

Pessoal,
sei poouco de Shell e nada de awk.
Estava verificando um problema em um script que foi inicialmente
feito para ksh no Unix e me deparei com o tal awk. Atualmente este=20
script se encontra em um ambiente Linux com bash .
Estou tendo a seguinte msg de erro

awk: cmd. line:1: printf("%s%s%s%s",$7,$3,$4,$5)
awk: cmd. line:1: ^ parse error
awk: cmd. line:2: printf("%s%s%s%s",$7,$3,$4,$5)
awk: cmd. line:2: ^ unexpected newline


Abaixo segue o script
#!/bin/bash
#obtem timestamp do arquivo informado
#Zonta 03/2003
function help {
echo "$0 - obtem o timestamp do arquivo -yyyymmddhhmmss"
echo "sintaxe:"
echo " $0 <nomearquivo> [-f]"
echo " -f =3D formatado DD MMM YYYY - hh:mm:ss"
echo "Aten=E7ao: utiliza arquivo temporario: diretorio atual
tem de ter direito de grava=E7=E3o"
}
if [ -z $1 ]; then
help
exit 1
fi
if [ ! -f $1 ]; then
help
echo "-------------------------------\n erro: $1 nao =E9 arquivo"
2>stderr
exit 1
fi
if [ "$2" !=3D "-f" ] &&
[ "$2" !=3D "" ]; then
help
echo "-------------------------------\n erro: parametro $2
invalido" 2>stderr
fi
temp=3D~tmp.$(date '+%Y%m%d%H%M%S').$RANDOM
strace -v lstat -t lstat ls -l $1 2>$temp>/dev/null
if [ "$2" =3D "" ]; then
echo $(grep "mt" $temp|sed -e "s/ / 0/g;s/Jan/01/g;
s/Feb/02/g;s/Mar/03/g;s/Apr/04/g;s/May/05/g;s/Jun/06/g;s/Jul/07/g;s/Au
g/08/g;s/Sep/09/g;s/Oct/10/g;s/Nov/11/g;s/Dec/12/g;s/://g"|awk
{'printf("%s%s%s%s",$7,$3,$4,$5)'})
else
echo $(grep "mt" $temp|sed -e "s/ / 0/g"|awk {'printf("%s %s %s -
%s",$4,$3,$7,$5)'})
fi
rm $temp




reply via email to

From: Unknown
[Prev in Thread] Current Thread [Next in Thread]