12-15-2014
As we dont know what OS you are using we cant figure out like that what error message you would be getting... but you were asked to try on command line tail -2 <a directory name> to see the behaviour of that command with a directory, we are not going to to your work for you...
Once you have tested and told us the result can we help you go further...
Since if you have corrected now your script to use $2 (which we hope is a numeric value...), you are left with solving how to input files for the given directory...
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
How can the head command be used to extract only a particular line.
By default head -n filename displays the first n lines. I want only the nth line.
I couldn't get it from forum search.
Thanks,
Sumesh (6 Replies)
Discussion started by: sumesh.abraham
6 Replies
2. UNIX for Dummies Questions & Answers
Hi friends,I am new to unix and this is really a dummy question.but please help me out.
How to simulate head command without using head command???
also tail command too,also more command.
it is given as a homework to do....please tell me how to do (2 Replies)
Discussion started by: nikhilneela
2 Replies
3. Shell Programming and Scripting
Hi, I have the following problem. I have files with one column of data (let's say file1.dat, file2.dat...file6.dat), and I would like to record the first value of the column of each file into another file (let's name it fileall.dat), which would have the the six values, one in each column. I use to... (4 Replies)
Discussion started by: josegr
4 Replies
4. Shell Programming and Scripting
Piece of code in sh file
------------------------
echo "lalit test bef"
which cp
cp $l_options $srcdirfile $destdirfile
echo "lalit test after"
echo "**************************options below"
echo "loption $l_options"
echo "src $srcdirfile"
echo "destinat... (3 Replies)
Discussion started by: lalitpct
3 Replies
5. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
I've been stuck on this problem for 2 days now
What command would you enter to list the first lines of all text... (11 Replies)
Discussion started by: partieboi37
11 Replies
6. Shell Programming and Scripting
Hi,
I need some advise on whether there is a better way of doing what I am currently planning to do. Perhaps I should be using arrays instead of re-directing output to files?
I need to use a tool/program named ADRCI provided by Oracle to remove trace files that it generates. Honestly it is... (1 Reply)
Discussion started by: newbie_01
1 Replies
7. Shell Programming and Scripting
the following unix command gives me the number of records avaiable in my application
/navs/sys/appl/bin/record list
This gives number of rows and colums. I want to generate one text file everyday at 6:10 AM using cron
So I added following entery into crontable
#Generate record file at... (6 Replies)
Discussion started by: Nakul_sh
6 Replies
8. Shell Programming and Scripting
Hi
1st problem
--------------
i have this sed command in my unix script which replaces new line and carriage return in a line with the string "
"
the script works fine in Linux 3.0.101-0.5, but not in AIX 1 7 , the "s/\r/\
/g" replacement, replaces
all the character "r" in the file.... (3 Replies)
Discussion started by: maximus_jack
3 Replies
9. Shell Programming and Scripting
we have a file as below
AREA,COUNTRY,RANK
A,MX,1
A,MX,2
A,MX,5
A,MX,8
A,IN,7
A,IN,5
A,IN,21
B,CN,6
B,CN,2
B,CN,8
B,CN,0
we need the TOP 2 RANK records for the combination of Area, Country as below. i know head -2, which gives top 2 records from file but not sure it lists based on... (7 Replies)
Discussion started by: JSKOBS
7 Replies
MSGS(1) General Commands Manual MSGS(1)
NAME
msgs - system messages and junk mail program
SYNOPSIS
msgs [ -fhlpq ] [ number ] [ -number ]
msgs -s
msgs -c [ -days ]
DESCRIPTION
Msgs is used to read system messages. These messages are sent by mailing to the login `msgs' and should be short pieces of information
which are suitable to be read once by most users of the system.
Msgs is normally invoked each time you login, by placing it in the file .login (.profile if you use /bin/sh). It will then prompt you with
the source and subject of each new message. If there is no subject line, the first few non-blank lines of the message will be displayed.
If there is more to the message, you will be told how long it is and asked whether you wish to see the rest of the message. The possible
responses are:
y type the rest of the message.
RETURN synonym for y.
n skip this message and go on to the next message.
- redisplay the last message.
q drops you out of msgs; the next time you run the program it will pick up where you left off.
s append the current message to the file ``Messages'' in the current directory; `s-' will save the previously displayed message. A `s'
or `s-' may be followed by a space and a file name to receive the message replacing the default ``Messages''.
m or `m-' causes a copy of the specified message to be placed in a temporary mailbox and mail(1) to be invoked on that mailbox. Both
`m' and `s' accept a numeric argument in place of the `-'.
Msgs keeps track of the next message you will see by a number in the file .msgsrc in your home directory. In the directory /usr/msgs it
keeps a set of files whose names are the (sequential) numbers of the messages they represent. The file /usr/msgs/bounds shows the low and
high number of the messages in the directory so that msgs can quickly determine if there are no messages for you. If the contents of
bounds is incorrect it can be fixed by removing it; msgs will make a new bounds file the next time it is run.
The -s option is used for setting up the posting of messages. The line
msgs: "| /usr/ucb/msgs -s"
should be include in /etc/aliases to enable posting of messages.
The -c option is used for performing cleanup on /usr/msgs. An entry with the -c option should be placed in /etc/crontab to run every
night. This will remove all messages over 21 days old. A different expiration may be specified on the command line to override the
default.
Options when reading messages include:
-f which causes it not to say ``No new messages.''. This is useful in your .login file since this is often the case here.
-q Queries whether there are messages, printing ``There are new messages.'' if there are. The command ``msgs -q'' is often used in
login scripts.
-h causes msgs to print the first part of messages only.
-l option causes only locally originated messages to be reported.
num A message number can be given on the command line, causing msgs to start at the specified message rather than at the next message
indicated by your .msgsrc file. Thus
msgs -h 1
prints the first part of all messages.
-number
will cause msgs to start number messages back from the one indicated by your .msgsrc file, useful for reviews of recent messages.
-p causes long messages to be piped through more(1).
Within msgs you can also go to any specific message by typing its number when msgs requests input as to what to do.
FILES
/usr/msgs/* database
~/.msgsrc number of next message to be presented
AUTHORS
William Joy
David Wasley
SEE ALSO
aliases(5), crontab(5), mail(1), more(1)
BUGS
4th Berkeley Distribution October 22, 1996 MSGS(1)