home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl --
- # Free replacement for Sun's shift_lines as required by Openwin's
- # text_extras_menu.
- #
- # Copyright (C) 1998 by Martin Buck <mbuck@debian.org>
- # Licensed under the GNU General Public License
-
- $shift = 1;
- if ($#ARGV >= 0) {
- if ($#ARGV != 1 || $ARGV[0] ne "-t") {
- die "Usage: $0 [-t <num>]\n";
- }
- $shift = $ARGV[1];
- }
-
- $spaces = "";
- if ($shift >= 0) {
- for ($s = 1; $s <= $shift; $s++) {
- $spaces = $spaces . " ";
- }
- }
-
- while (<STDIN>) {
- if ($shift < 0) {
- print substr($_, -$shift);
- } else {
- print $spaces . $_;
- }
- }
-