From: | "Michael R(dot) Jinks" <mjinks(at)uchicago(dot)edu> |
---|---|
To: | redhat-list(at)redhat(dot)com |
Cc: | pgsql-novice(at)postgresql(dot)org, interchange-users(at)minivend(dot)com |
Subject: | Re: Removing all instances of "NOT NULL" from an entire directory of files |
Date: | 2000-09-12 00:04:49 |
Message-ID: | 20000911190449.B833@uchicago.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Try this:
find /path/to/files -type f -exec perl -pi -e "s/NOT NULL//g" {} \;
Check the find(1) manpage for an explanation of the -exec directive.
HTH,
-m
On Mon, Sep 11, 2000 at 08:02:17PM -0400, rpjday wrote:
> On Mon, 11 Sep 2000, Dan Browning wrote:
>
> > OK, I've got a command (or two) that will remove all NOT NULL strings from a
> > given file.
> >
> > cat filename | perl -pi -e "s/NOT NULL//g" > filename
> >
> > But how do I run that command on every file in a directory, successively?
> >
>
> whoa, the above perl program does NOT need to have input piped into it.
> all you need to say is:
>
> $ perl -pi -e "s/NOT NULL//g" file1 file2 file3 ...
>
> one at a time, each file argument will be edited *in place*, saved
> back into the original file, and processing moves to the next file.
>
> if you want to play it safe, use the option "-pi.BAK" instead, which
> will copy the original file to the name file.BAK (or whatever suffix
> you want) before doing the actual editing.
>
> rday
>
> p.s. warning. running any command on a file, and trying to redirect
> the new output back to the original file, is a recipe for DISASTER!
> most likely, due to the way redirection works, the file will be wiped
> and you will lose *all* of its contents.
>
>
>
> _______________________________________________
> Redhat-list mailing list
> Redhat-list(at)redhat(dot)com
> https://listman.redhat.com/mailman/listinfo/redhat-list
--
Michael Jinks, IB
Systems Administrator, CCCP
finger mjinks(at)embley(dot)spc(dot)uchicago(dot)edu for public key
Vote Duke! http://www.entertaindom.com/pages/duke2000/home.jsp
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Smith | 2000-09-12 00:23:06 | inserting a file into a database. |
Previous Message | Dan Browning | 2000-09-11 23:34:52 | Removing all instances of "NOT NULL" from an entire directory of files |