merlyn@iwarp.intel.com (Randal Schwartz) (07/28/90)
In article <1990Jul27.182221.7202@cid.aes.doe.CA>, afsipmh@cid (Patrick Hertel) writes: | | How would i go about doing the following (ed,sed,ex,vi,awk,perl even): | | Take a file something like this -> | | *DECK A | jcl | jcl | *DECK B | jcl | . | *DECK PAT | etc. | | .. and divide it up into files with names A, B, PAT (or whatever follows *DECK). This is the hard part, at laest for me because I am not fully UNIX literate | yet.. In Perl, it'd be: perl -ne 'if (/^\*DECK (.*)/) {open(STDOUT,">$1");} else {print;}' Yourfile You could probably do it with awk too. Maybe even Fortran. :-) Just another Perl hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/