Re: A challenge for UNIX wizards
Article: 7883 of alt.hackers Newsgroups: alt.hackers From: cmcurtin@clipper.cb.att.com (C Matthew Curtin) Subject: Re: A challenge for UNIX wizards Message-ID: D95J9o.HCI@nntpa.cb.att.com Sender: news@nntpa.cb.att.com (Netnews Administration) Nntp-Posting-Host: clipper.cb.att.com Organization: AT&T Bell Labs Date: Thu, 25 May 1995 20:51:24 GMT Approved: By 90% of all the world's UNIX wizards. Lines: 27 Status: RO
In article <3q185g$3je@lll-winken.llnl.gov>, Sam Trenholme <set@oryx.llnl.gov> wrote: >Ok guys, is there a way of doing this without using a temporary file: > >ls | awk 'BEGIN{FS="."}{print "mv "$0" "$1".1"}' > l;chmod 700 l;l;rm l > >(The above made a list of files, foo.man, bar.man, etc. have the names >foo.1, bar.1, etc) Just to make sure I understand: You want to take a directory full of files names something.man and turn them all into something.1, without using any temp files? That's easy :-) ObMiniHack: We're assuming ksh (or at least sh) here... Just type this off of the command line: for x in `ls *.man` do mv $x `ls $x | sed s/\.man/\.1/g` done Aren't regular expressions great? -- C Matthew Curtin AT&T Bell Labs - Internet Gateway Group cmcurtin@clipper.cb.att.com