08-27-2006
read a list one at a time
just have a muddled head at the moment... bare with me.
say i have a variable $count... and a list in a file
i want to use the $count line from that textfile but don't seem to recall how to access it?
eg
user=`cat file1.txt` # user to be $count line in that list?
eg
david
mark
james
kevin # want to extract mark as the $count variable
if someone could steer me to the right function I'd greatly appreciate the tip...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
There are two scripts. The second script is called from the first one. These will create two processes on unix. In the second script, there is a read statement in the while loop.
Under unexpected conditions, at the time of reading response from the user, if the terminal hungup happens,... (1 Reply)
Discussion started by: pkusumam
1 Replies
2. Shell Programming and Scripting
Hi All,
Please advise . Welcome more suggestions.
For examples, I have 1000 file with prefix x??? In fact, I want to convert them to x???.txt with max 10 files at a time. As such, I will need to call another script to read from those 10 *txt files and sleep 5000 to convert the next 10 again.... (10 Replies)
Discussion started by: cedrichiu
10 Replies
3. Shell Programming and Scripting
Hello
I'm stuck trying to solve this KSH issue and I'm hoping someone out there can offer some suggestions.
I want to read lots of large .gz files one line at a time in order to compare its Error entries with a list of known errors. I can't simply do "foreach ERROR do gzcat *.gz |grep... (2 Replies)
Discussion started by: dayscripter
2 Replies
4. Shell Programming and Scripting
Hi friends,
It's urgent. I am facing a problem. I want to read two files at a time, i mean line by line.
My requirement is like , pls here find below
while read line1fromfile1;do
echo $line1fromfile1|
.. echo $line1fromfile2---How i will do this
done< file 1
can anyone... (5 Replies)
Discussion started by: pritish.sas
5 Replies
5. Shell Programming and Scripting
hi,
how to check the file latest read time.. (2 Replies)
Discussion started by: rsivasan
2 Replies
6. Shell Programming and Scripting
Hi
I am new to writing script and want to use a Bash Piped while-read and read from user input.
if something happens on server.log then do while loop or if something happend on user input then do while loop.
Pseudocode something like:
tail -n 3 -f server.log | while read serverline || read... (8 Replies)
Discussion started by: MyMorris
8 Replies
7. Shell Programming and Scripting
Hello community,
what I need to do is read 2 rows at time from a file. I have this simple solution:
File to read:
LINE1
LINE2
LINE3
LINE4
LINE5
LINE6
LINE7
LINE8Read routine:#!/bin/ksh
sed '1,3d' /out.txt | while read line; do
read line2
echo $line $line2
doneResult:LINE1... (5 Replies)
Discussion started by: Lord Spectre
5 Replies
8. Shell Programming and Scripting
Hello All,
I have a file like below....
dn: cn=user1,ou=org,o=org
cn=user1
uid=user1
cn=user2,ou=org,o=org
cn=user2
uid=user2
cn=user3,ou=org,o=org
cn=user3
cn=user33
uid=user3
cn=user4,ou=org,o=org
cn=user4
uid=user4 (6 Replies)
Discussion started by: s_linux
6 Replies
9. IP Networking
Hi,
When can the read() system call gives timeout error when the same connection worked for writing data to the other end of the socket, while the next call with read() gives timeout error?
Can anyone please explain when this kind of situation appears?
Thanks,
Sanzee (2 Replies)
Discussion started by: sanzee007
2 Replies
10. Shell Programming and Scripting
Hello Team,
I need information on how to read one row at time using shell script. For example i have below data.
service-description servername warning critical mountpoint
disk-usage-tmp generic-service test1 80 90 /tmp
disk-usage-var ... (6 Replies)
Discussion started by: ghpradeep
6 Replies
MT(1) GNU CPIO MT(1)
NAME
mt - control magnetic tape drive operation
SYNOPSIS
mt [-V] [-f device] [--file=device] [--rsh-command=command] [--version] operation [count]
DESCRIPTION
This manual page documents the GNU version of mt. mt performs the given operation, which must be one of the tape operations listed below,
on a tape drive.
The default tape device to operate on is taken from the file /usr/include/sys/mtio.h when mt is compiled. It can be overridden by giving a
device file name in the environment variable TAPE or by a command line option (see below), which also overrides the environment variable.
The device must be either a character special file or a remote tape drive. To use a tape drive on another machine as the archive, use a
filename that starts with `HOSTNAME:'. The hostname can be preceded by a username and an `@' to access the remote tape drive as that user,
if you have permission to do so (typically an entry in that user's `~/.rhosts' file).
The available operations are listed below. Unique abbreviations are accepted. Not all operations are available on all systems, or work on
all types of tape drives. Some operations optionally take a repeat count, which can be given after the operation name and defaults to 1.
eof, weof
Write count EOF marks at current position.
fsf Forward space count files. The tape is positioned on the first block of the next file.
bsf Backward space count files. The tape is positioned on the first block of the next file.
fsr Forward space count records.
bsr Backward space count records.
bsfm Backward space count file marks. The tape is positioned on the beginning-of-the-tape side of the file mark.
fsfm Forward space count file marks. The tape is positioned on the beginning-of-the-tape side of the file mark.
asf Absolute space to file number count. Equivalent to rewind followed by fsf count.
seek Seek to block number count.
eom Space to the end of the recorded media on the tape (for appending files onto tapes).
rewind Rewind the tape.
offline, rewoffl
Rewind the tape and, if applicable, unload the tape.
status Print status information about the tape unit.
retension
Rewind the tape, then wind it to the end of the reel, then rewind it again.
erase Perform long erase of tape. If count is 0, perform short erase of tape (some devices do not support this).
mt exits with a status of 0 if the operation succeeded, 1 if the operation or device name given was invalid, or 2 if the operation failed.
OPTIONS
-f, --file=device
Use device as the file name of the tape drive to operate on. To use a tape drive on another machine, use a filename that starts
with `HOSTNAME:'. The hostname can be preceded by a username and an `@' to access the remote tape drive as that user, if you have
permission to do so (typically an entry in that user's `~/.rhosts' file).
--rsh-command=command
Notifies mt that it should use command to communicate with remote devices instead of /usr/bin/ssh or /usr/bin/rsh.
-V, --version
Print the version number of mt.
BUG REPORTS
Report bugs to <bug-cpio@gnu.org>.
COPYRIGHT
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
MT January 28, 2014 MT(1)