home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: fj.questions.unix
- Path: sparky!uunet!ccut!news.u-tokyo.ac.jp!wnoc-tyo-news!sranha!sranhd!sran230!utashiro
- From: utashiro@sran230.sra.co.jp (Kazumasa Utashiro)
- Subject: Re: recover over-written tar floppy
- References: <SHIBATA.93Jan4172938@tutuser.tut.ac.jp>
- Organization: Software Research Associates, Inc., Japan
- Date: Mon, 11 Jan 1993 08:03:21 GMT
- Message-ID: <C0oJpn.CLx@sran230.sra.co.jp>
- Distribution: fj
- Lines: 47
-
- In article <SHIBATA.93Jan4172938@tutuser.tut.ac.jp>
- shibata@tutuser.tut.ac.jp (SHIBATA Ryoichi) writes:
- >> $B$=$7$F!"$3$l$rFI$_$@$=$&$H$7$?$N$G$9$,!"(J
- >> tar xvf /dev/rfh0a
- >> $B$H$7$J$1$l$P$J$i$J$$$H$3$m$r!"(J
- >> tar cvf /dev/rhf0a
- >> $B$H$7$F$7$^$$!"@hF,$K2?$+$r>e=q$-$7$?>uBV$K$J$C$F$7$^$$$^$7$?!#(J
- >> $B$=$N$?$a!"(Jtar tvf $B$d(J tar xvf $B$7$F$b!"2?$bI=<($5$l$^$;$s!#(J
- >>
- >> $B;O$a$KJ]B8$7$?FbMF$O?tI4(JKB$B$G$"$j!"$b$7%7!<%1%s%7%c%k$K(J
- >> $B>e=q$-$5$l$k$N$G$"$l$P!";D$j$r2?$H$+FI$_$@$7$?$$$H(J
- >> $B;W$C$F$$$^$9!#(J
- >> $B$J$*!"4D6-$O(J NWS-3260 + NEWS-0S4.2R $B$G$9!#(J
-
- 1$BJ,$G:n$C$?!"L>A0$rIU$1$k5$$K$b$J$i$J$$4s$;=8$a$N%W%m%0%i%`(J
- $B$G$9$,!"$3$s$J$N$G$&$^$/$$$+$J$$$G$7$g$&$+!#(J
-
- ----------------------------------------------------------------------
- #!/usr/local/bin/perl
-
- $tar_header_format = "a100 a8 a8 a8 a12 a12 a8 a a100 a*";
- ($tar_name, $tar_mode, $tar_uid, $tar_gid, $tar_size,
- $tar_mtime, $tar_chksum, $tar_linkflag, $tar_linkname, $tar_pad) = (0..9);
-
- sub tarheader {
- ($_[$tar_mode] =~ /^[ 0-7]{7}\0$/) &&
- ($_[$tar_uid] =~ /^ *\d+ *\0$/) &&
- ($_[$tar_gid] =~ /^ *\d+ *\0$/) &&
- ($_[$tar_size] =~ /^ *\d+ *\0?$/) &&
- ($_[$tar_mtime] =~ /^ *\d+ $/); ## Is this enough?
- }
-
- while (read(STDIN, $_, 512)) {
- if (/\0/ && &tarheader(unpack($tar_header_format, $_))) {
- printf STDERR "skipped %d block%s\n", $skip, 's' x ($skip > 1);
- print;
- last;
- }
- $skip++;
- }
-
- print while read(STDIN, $_, 8192);
- ----------------------------------------------------------------------
-
- $BBLL\$J$i!"%A%'%C%/$r$b$C$H87$7$/$7$F$_$k$H$$$$$H;W$$$^$9!#(J
-
- --utashiro
-