* tr problem?
@ 1996-07-10 4:00 Greg Robinson
1996-07-10 4:00 ` John Hascall
1996-07-11 4:00 ` Steffen Kluge
0 siblings, 2 replies; 3+ messages in thread
From: Greg Robinson @ 1996-07-10 4:00 UTC (permalink / raw)
hi,
Can anyone make tr work with the following input?
./qfKAA12670
./qfKAA14036
./qfJAA06816
./qfKAA14029
./qfJAA08041
./qfKAA13145
I want to replace the qf with ?? so it removes the header file, body file
and status file. ie. qf, df and xf files...
I am using the tr line thus:
tr -s 'a-z' '[??*]' < filename
This doesnt NOT work!
BUT, if the file is:
./dfKAA12670
./dfKAA14036
./dfJAA06816
./dfKAA14029
./dfJAA08041
./dfKAA13145
It does work!
It's for clearing out a mail from the mail spool after a storm... *sigh*
Thankx!
Greg.
--
Work: greg.robinson@dsto.defence.gov.au
Home: greg@arrakis.satech.net.au
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: tr problem?
1996-07-10 4:00 tr problem? Greg Robinson
@ 1996-07-10 4:00 ` John Hascall
1996-07-11 4:00 ` Steffen Kluge
1 sibling, 0 replies; 3+ messages in thread
From: John Hascall @ 1996-07-10 4:00 UTC (permalink / raw)
Greg Robinson <robinson@fang.dsto.defence.gov.au> wrote:
}Can anyone make tr work with the following input?
}./qfKAA12670
...
}./qfKAA13145
}I want to replace the qf with ?? so it removes the header file, body file
}and status file. ie. qf, df and xf files...
}I am using the tr line thus:
}tr -s 'a-z' '[??*]' < filename
tr is for a 1-for-1 replacement of characters. while it
can be made to work in this case, using sed is easier:
sed 's/qf/??/' < filename
John
--
John Hascall, Software Engr. Shut up, be happy. The conveniences you
ISU Computation Center demanded are now mandatory. -Jello Biafra
john@iastate.edu
http://www.cc.iastate.edu/staff/systems/john/welcome.html <-- the usual crud
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: tr problem?
1996-07-10 4:00 tr problem? Greg Robinson
1996-07-10 4:00 ` John Hascall
@ 1996-07-11 4:00 ` Steffen Kluge
1 sibling, 0 replies; 3+ messages in thread
From: Steffen Kluge @ 1996-07-11 4:00 UTC (permalink / raw)
In article <4rvc34$n6l@fang.dsto.defence.gov.au>,
Greg Robinson <robinson@fang.dsto.defence.gov.au> wrote:
>hi,
>
>Can anyone make tr work with the following input?
>
>./qfKAA12670
>./qfKAA14036
>./qfJAA06816
>./qfKAA14029
>./qfJAA08041
>./qfKAA13145
>
>I want to replace the qf with ?? so it removes the header file, body file
>and status file. ie. qf, df and xf files...
>
>I am using the tr line thus:
>
>tr -s 'a-z' '[??*]' < filename
>
>This doesnt NOT work!
>
>BUT, if the file is:
>
>./dfKAA12670
>./dfKAA14036
>./dfJAA06816
>./dfKAA14029
>./dfJAA08041
>./dfKAA13145
>
>It does work!
>
>It's for clearing out a mail from the mail spool after a storm... *sigh*
>[...]
I'm not sure if I understand you problem well, in case you just
want to delete the files just do
$ rm /var/spool/[qdx]f*
If you really want to rename them you could use the string substitution
capabilities of you shell (if it is powerful enough). For example,
using ksh:
$ for f in /var/spool/[qdx]f*; do
> mv $f '??'${f#??}
> done
$
Hope this helps
Steffen.
--
Steffen Kluge <kluge@ave.ac.agit.de>
ave GmbH Aachen
Keywords: photography, Mozart, UNIX, Islay Malt
--
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1996-07-11 4:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-07-10 4:00 tr problem? Greg Robinson
1996-07-10 4:00 ` John Hascall
1996-07-11 4:00 ` Steffen Kluge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox