02-14-2008
Use a for loop
#! /bin/bash
for zf in *myfile*.*
do
ls -l $zf
tail $zf
done
Notes:
(1) I do an ls command; not needed - just shows what file is being looked at in the loop
(2) tail is its own command line since guess you want to do more than simply execute this one command
This could all be done in one line as:
tail *myfile*.*
but, I figure this is part of something more complicated.
So, two choices.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
This site has been very helpful thus far.. I thank you all in advance for sharing the knowledge. Let me get to it.
I am trying to write a very small script to take away from the boredom of doing the same thing over and over.
Everynow and again I have to get the hex value of a file using a... (2 Replies)
Discussion started by: BkontheShell718
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script.
I am planning to do like this:
if ; then... (2 Replies)
Discussion started by: new_learner
2 Replies
3. UNIX for Dummies Questions & Answers
Hi folks,
Please advise which command/command line shall I run;
1) to display the command and its output on console
2) simultaneous to save the command and its output on a file
I tried tee command as follows;
$ ps aux | grep mysql | tee /path/to/output.txt
It displayed the... (7 Replies)
Discussion started by: satimis
7 Replies
4. Shell Programming and Scripting
Hi guys...
I am new to this scripting...so please forgive me if anything worng in my questions...
here is my question..
I have file structure
/home/oracle/<sid>/logs/bkup
now i want to write a script which should grep the sid name from a file..and it should replace the <SID> with... (1 Reply)
Discussion started by: troubleurheart
1 Replies
5. UNIX for Dummies Questions & Answers
I would appreciate any help.
I need to run 'ps -ef | grep 'process', get the process id and kill that process.
I have got this far:
- Get pid using ps -ef | awk '/process/{ print $2}'
after this I'm kind of stuck..
- Use pipe to redirect the output to kill
pid=ps -ef | awk '/bmserver/{... (2 Replies)
Discussion started by: foxtron
2 Replies
6. Shell Programming and Scripting
Hi All,
How do I provide the output of a command to another command which is waiting for an input from the user ?
Ex : I need to login to a device via telnet. In the script, initially I use the "read" command to get the IP Address, Username and Password of the device from the user. Now,... (1 Reply)
Discussion started by: sushant172
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I would like to know if this is possible, and if so what can i do to make this work.
I would like to grep a line X from fileA and then use the output to replace a word Y in fileB.
grep "line X" fileA | sed -e 's/Y/X/g' > outfile
this statement does not work, as i do not know how to... (7 Replies)
Discussion started by: cavanac2
7 Replies
8. Shell Programming and Scripting
Hi All,
Hoping you can help as im in desperate need... I'm very new to unix scripting so apoligies,
I have setup an expect script in order to log into a node on our network, This will provide an output as per the below
*********** information:
*************: n/a
TEST IP : n/a
... (18 Replies)
Discussion started by: mutley2202
18 Replies
9. UNIX for Dummies Questions & Answers
Hello,
I'm using cygwin on my Windows 7 machine.
From the man pages of cut:
--output-delimiter=STRING
use STRING as the output delimiter the default is to use the input delimiter
I tried the following commands and got the error messages:
$ cut -c1-10,20-30 -d... (10 Replies)
Discussion started by: kojac
10 Replies
10. Shell Programming and Scripting
I am using UNIX to create a script on our system. I have setup my commands to append their output to an outage file. However, some of the commands return no output and so I would like something to take their place.
What I need
The following command is placed at the prompt:
TICLI... (4 Replies)
Discussion started by: jbrass
4 Replies
iconv(1) General Commands Manual iconv(1)
Name
iconv - international codeset conversion
Syntax
iconv [-d] -f fromcodeset -t tocodeset [file...]
Description
The command converts the encoding of characters in its input from one codeset to another codeset. The fromcodeset argument specifies the
codeset used to encode the data in the input; that is, it specifies the input codeset. The tocodeset argument specifies the codeset to
which you want the input data converted; that is, it specifies the output codeset. The command performs the conversion by reading rules
from a conversion table you create. The command reads its input from standard input or from one or more files named on the command line.
The command writes its output to standard output.
You define conversion rules in a conversion table. The conversion rules specify how converts a particular character or group of characters,
which are called tokens. The conversion table is a text file that contains two lists. In the left-hand list, you specify each token you
want to convert. In the right-hand list, you specify the token you want to create in the output file. For example, if you issued the fol-
lowing command:
% iconv -fupper -tlower conversion_file
This command uses the conversion table located in the file that specifies how to convert from an uppercase codeset to a lowercase codeset.
The following shows part of the conversion table:
#
# Converts from uppercase to lowercase
#
# Input token Output token
# ------------- ------------------
A a
B b
C c
D d
E e
F f
G g
.
.
.
Z z
#
# Convert tabs to spaces using octal
#
11 40 40 40
#
# Convert the A umlaut to lowercase
#
A a
Each line in the conversion table must contain two strings, an input token and an output token. The tokens must be delimited with spaces
or tabs. The backslash character ( ) either causes the command to recognize a character it normally ignores or introduces a three digit
octal constant. All octal constants in the conversion table must contain three digits. Lines that begin with a hash symbol (#) are com-
ments. The command ignores comment lines and blank lines.
You name the conversion table file using the name of the input codeset, an underscore, and the name of the output codeset. For example, if
your input codeset is ISO646 and your output codeset is ISO8859, you might name the conversion table file
The command searches for the conversion table file in the directory specified by the pathname. If the ${ICONV} environment variable is
undefined, the command searches the directory.
The operation of the command is 8-bit transparent.
Options
-d Deletes any characters that are omitted from the conversion table. By default, the command sends characters that are omitted to the
output file without modifying them.
-f Specifies the name of the input codeset.
-t Specifies the name of the output codeset.
Restrictions
The conversion table file name can contain no more than 255 characters. You may need to truncate the name of the input codeset or output
codeset when you name the conversion table file.
Examples
The following shows an example of using the command:
This command converts the data in from ISO646 encoding to ISO8859 encoding. The command reads the conversion table from the file. If the
${ICONV} environment variable is undefined, the command uses the file. If that file does not exist, the command issues an error message and
does not convert the data file. The command writes the results of any conversion it performs to the file
Files
See Also
environ(5int)
Guide to Developing International Software
iconv(1)