I'd like to get only the first 5 lines of the ls -lt command, i tried to pass to head as a file ip but didnt work, is there any other way to do it.
I am trying to find the lates log files for the last 5 days.
what i tried
head -5 < ls -lt alog*
Thanks.
-d (1 Reply)
Is there a way to combine two lines onto a single line...append the following line onto the previous line?
I have the following file that contains some blank lines and some lines I would like to append to the previous line...
current file:
checking dsk c19t2d6
checking dsk c19t2d7
... (2 Replies)
I seem to have gotten myself in over my head on this one. I need help combining lines together.
I have a text file containing 24,000 lines (exactly why I need awk) due to bad formatting it has separated the lines (ideally it should be 12,000 lines total).
Example of file:
... (2 Replies)
Dear Experts
I am trying to find if it is possible to combine unix commands in awk program. For example if it is possible embed rm or ls or any unix command inside the awk program and while it is reading the file besides printing be able to do some unix commands. I am thinking may be just print... (2 Replies)
Hi
I am fairly new to shell scripting
i have some file with outout
1011
abc fyi
6.1.4.5
abr tio
70986
dfb hji
4.1.7
....some text
111114
i have to format this text to
1011 abc fyi 6.1.4.5 abr tio
70986 dfb hji 4.1.7 ....some text
111114 (3 Replies)
This is the problem actually:
This regex:
egrep "low debug.*\".*\"" $dbDir/alarmNotification.log
is looking for data between the two quotation marks:
".*\"
When I hate data like this:
low debug 2009/3/9 8:30:20.47 ICSNotificationAlarm Prodics01ics0003 IC... (0 Replies)
Hi,
I am using SunOS
I want to serch my previous command
from unix prompt
(like on AIX we can search by ESC -k)
how to get in SunOs
urgent help require. (10 Replies)
I am trying to come up with a good approach to taking a file and only printing 10 columns.
The input file has duplicate lines but only the 6th column has real value.
I just need to combine the lines and output 1 line per
example file:
1 2.0765 AA 10 0.6557 .....
1 2.0765 AA 10 0.6655 .....
2... (12 Replies)
Dear all,
I have a file like this:
imput
scaffold_0 1
scaffold_0 10000
scaffold_0 20000
scaffold_0 25000
scaffold_1 1
scaffold_1 10000
scaffold_1 20000
scaffold_1 23283
and I want the output like this:
scaffold_0 1 scaffold_0 10000
scaffold_0 10000 scaffold_0 20000... (6 Replies)
Hi All,
I have a file which has the following sample lines
--
<Member name="Canada"
Currency="CAD"
--
<Member name="UK"
Currency="GBP"
--
<Member name="Switzerland"
Currency="CHF"
--
<Member name="Germany"
Currency="EUR"
-- (11 Replies)
Discussion started by: dev.devil.1983
11 Replies
LEARN ABOUT DEBIAN
shell-quote
SHELL-QUOTE(1p) User Contributed Perl Documentation SHELL-QUOTE(1p)NAME
shell-quote - quote arguments for safe use, unmodified in a shell command
SYNOPSIS
shell-quote [switch]... arg...
DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands
or files with embedded white space or shell globbing characters safely. Here are a few examples.
EXAMPLES
ssh preserving args
When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and
passes them to "$SHELL -c". This doesn't work as intended:
ssh host touch 'hi there' # fails
It creates 2 files, hi and there. Instead, do this:
cmd=`shell-quote touch 'hi there'`
ssh host "$cmd"
This gives you just 1 file, hi there.
process find output
It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to
split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote:
eval set -- `find -type f -print0 | xargs -0 shell-quote --`
debug shell scripts
shell-quote is better than echo for debugging shell scripts.
debug() {
[ -z "$debug" ] || shell-quote "debug:" "$@"
}
With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can.
save a command for later
shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command
you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are
things the user can't pass through), you can do something like this:
user_switches=
while [ $# != 0 ]
do
case x$1 in
x--pass-through)
[ $# -gt 1 ] || die "need an argument for $1"
user_switches="$user_switches "`shell-quote -- "$2"`
shift;;
# process other switches
esac
shift
done
# later
eval "shell-quote some-command $user_switches my args"
OPTIONS --debug
Turn debugging on.
--help
Show the usage message and die.
--version
Show the version number and exit.
AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions.
AUTHOR
Roderick Schertler <roderick@argon.org>
perl v5.8.4 2005-05-03 SHELL-QUOTE(1p)