home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 February
/
PCWorld_2000-02_cd.bin
/
live
/
usr
/
X11R6
/
bin
/
shift_lines
< prev
next >
Wrap
Text File
|
1998-11-18
|
561b
|
30 lines
#!/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 . $_;
}
}