From: Murray R. Van Luyn. on 31 Dec 2009 06:10 Hi, I want to set the file modification times of files stored in a zip file. I think I could work out how to unzip the files to a temporary location, hit them with touch to modify their timestamps, and then store them back in a new zip file that overwrites the original. I then have to clean-up the temporary files. Obviously my method would involve a series of commands. Okay, can any sneaky shell gurus think of a single command line that unzips the files, pipes them through touch, and then pipes the results to zip to replace the original archive? Muz.
From: Sidney Lambe on 31 Dec 2009 07:19 On comp.unix.shell, houghi <houghi(a)houghi.org.invalid> wrote: > Murray R. Van Luyn. wrote: > >> Okay, can any sneaky shell gurus think of a single command >> line that unzips the files, pipes them through touch, and then >> pipes the results to zip to replace the original archive? > > What is the reason it must be a oneliner? Just curious. Good question. If, for some weird reason, there can't be any newlines within the script, he can use semi-colons instead. line 1 ; line 2 ; line 3 ... Sid
From: Murray R. Van Luyn. on 31 Dec 2009 07:21 "houghi" <houghi(a)houghi.org.invalid> wrote in message news:slrnhjp2n1.u03.houghi(a)penne.houghi... > Murray R. Van Luyn. wrote: >> Okay, can any sneaky shell gurus think of a single command line that >> unzips >> the files, pipes them through touch, and then pipes the results to zip to >> replace the original archive? > > What is the reason it must be a oneliner? Just curious. > > houghi > -- > If you owe the bank $100 that's your problem. > If you owe the bank $100 million, that's the bank's problem. > If you owe the bank $700 billion, it becomes your problem again. Hi houghi, That I wish to perform the task as a 'one liner' is purely of academic interest. I'm just curious about how the piping mechanism works, and whether it can be used to pass whole files between programs. Muz.
From: Murray R. Van Luyn. on 31 Dec 2009 07:29 "Sidney Lambe" <sidneylambe(a)nospam.invalid> wrote in message news:slrnhjp5lc.pga.sidneylambe(a)evergreen.net... > On comp.unix.shell, houghi <houghi(a)houghi.org.invalid> wrote: > >> Murray R. Van Luyn. wrote: >> >>> Okay, can any sneaky shell gurus think of a single command >>> line that unzips the files, pipes them through touch, and then >>> pipes the results to zip to replace the original archive? >> >> What is the reason it must be a oneliner? Just curious. > > Good question. If, for some weird reason, there can't be > any newlines within the script, he can use semi-colons instead. > > line 1 ; line 2 ; line 3 ... > > Sid > > Hi Sidney, Ah, that's one solution I hadn't thought of, but is interesting to note. Thanks for that useful tip. Yeah, it's really the elegance of piping whole files that I'm most curious about. Muz.
From: Sidney Lambe on 31 Dec 2009 08:09 On comp.unix.shell, Murray R. Van Luyn. <valid(a)email.address> wrote: > "Sidney Lambe" <sidneylambe(a)nospam.invalid> wrote in message > news:slrnhjp5lc.pga.sidneylambe(a)evergreen.net... > >> On comp.unix.shell, houghi <houghi(a)houghi.org.invalid> wrote: >> >>> Murray R. Van Luyn. wrote: >>> >>>> Okay, can any sneaky shell gurus think of a single command >>>> line that unzips the files, pipes them through touch, and >>>> then pipes the results to zip to replace the original >>>> archive? >>> >>> What is the reason it must be a oneliner? Just curious. >> >> Good question. If, for some weird reason, there can't be any >> newlines within the script, he can use semi-colons instead. >> >> line 1 ; line 2 ; line 3 ... >> >> Sid >> > > > Hi Sidney, > > Ah, that's one solution I hadn't thought of, but is interesting > to note. Thanks for that useful tip. > > Yeah, it's really the elegance of piping whole files that I'm > most curious about. > > Muz. > > I can relate to that, Murray, but I think you better choose something other than touch for your experiments, because I don't think it takes piped input. Here's a couple of relevant scripts you might find enlightening. They are used to send a bunch of files to a remoted machine using netcat (nc). "1234" is the port number: Send tar cfp - /some/dir | compress -c | nc -w 3 othermachine 1234 Receive nc -l -p 1234 | uncompress -c | tar xvfp - Sid
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Redirect stdout and stderr preserving the original order Next: find files from specific date |