08-02-2012
you can use awk '{print "10.0.0.1" "," $0}' infile
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
If I have a data file containing entries like-> abc abc:123
and I use a for loop:
for I in `cat data-file`
do
echo $I
done
the output would contain 2 lines -> abc.... and abc:123
but I want it to be on only one line. How can I do this?
thanks (1 Reply)
Discussion started by: sleepster
1 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I'm having some trouble reading a file that was 'cat' through a while loop. Can anyone suggest alternatives? what i do is
cat filename|grep *.stuff
while read line
do
echo $line
... and other commands
done
The cat,grep line seems to work correctly, but the script hangs when i add in... (3 Replies)
Discussion started by: chugger06
3 Replies
3. Shell Programming and Scripting
I am writing a script that is running a loop on one file to obtain records from another file.
Using egrep, I am finding matching records in file b, then outputing feilds of both into another file.
****************************
filea=this.txt
fileb=that.txt
cat $filea | while read line
do... (1 Reply)
Discussion started by: djsal
1 Replies
4. Shell Programming and Scripting
Hi I have a simple code that I want to execute.
out=out.txt
for f in `cat list.txt | head -1`; do
echo $f >> $out
echo "sleep 5" >> $out
done
cat list.txt | head -1
wget -q -O - 'http://test.com:15100/cgi-bin/search
cat out.txt
wget
sleep 5
-q
sleep 5
-O (10 Replies)
Discussion started by: soemac
10 Replies
5. Shell Programming and Scripting
STEP 1
# Set variable
FILE=/tmp/mainfile
SEARCHFILE =/tmp/searchfile
# THIS IS THE MAIN FILE.
cat /tmp/mainfile
Interface Ethernet0/0 "outside", is up, line protocol is up
Hardware is i82546GB rev03, BW 100 Mbps
Full-Duplex(Full-duplex), 100 Mbps(100 Mbps)
MAC address... (6 Replies)
Discussion started by: irongeekio
6 Replies
6. Shell Programming and Scripting
Hello,
So I sorted my file as I was supposed to:
sort -n -r -k 2 -k 1 file1 | uniq > file2
and when I wrote
> cat file2
in the command line, I got what I was expecting, but in the script itself
...
sort -n -r -k 2 -k 1 averages | uniq > temp
cat file2
It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies
7. Shell Programming and Scripting
ok..
so problem is:
I have a file that reads:
cat 123
1 and 2
3 and 4
5 and 6
I was using for loops to run through this information.
Code:
for i in `cat 123`
do
echo $i
done
shouldn't the output come as
1 and 2 (3 Replies)
Discussion started by: foal_11
3 Replies
8. Shell Programming and Scripting
Hello...
I am trying to loop through my hosts file that contains 100+ servers to check or update the nameservers on them...
My while loop is breaking after the first server responds...
#!/bin/bash
while read line; do
a=( $(echo $line | tr " " "\n") )
if }" != "" ] && }" != "#" ] &&... (1 Reply)
Discussion started by: CompSCI
1 Replies
9. Shell Programming and Scripting
Hi Team,
Not getting the file output inside my email which i am sending from unix box. . Please refer the below code :
#!/bin/sh
{
sleep 5
echo ehlo 10.56.185.13
sleep 3
echo mail from: oraairtel@CNDBMUREAPZP02.localdomain
sleep 3
echo rcpt to: saurabhtripathi@anniksystems.com... (1 Reply)
Discussion started by: tripathi1990
1 Replies
10. UNIX for Beginners Questions & Answers
Good day to all,
I'd like to ask for your advice with regards to this.
Scenario :
I have here a file named TEST.tmp wherein the value inside is below;
"ONE|TWO|FIVE|THREE|FOUR|SIX~SEVEN~EIGHT" "NINE"
But when I'm trying to use this in a simple command like;
for TESTING in $(cat... (4 Replies)
Discussion started by: asdfghjkl
4 Replies
makedbm(8) System Manager's Manual makedbm(8)
NAME
makedbm - Makes a Network Information Service (NIS) dbm file
SYNOPSIS
/var/yp/makedbm [-i yp_input_file] [-s yp_secure_name] [-a method] [-o yp_output_name] [-d yp_domain_name] [-m yp_master_name] infile out-
file
/var/yp/makedbm [-u dbmfilename]
OPTIONS
Specifies that NIS maps are to be stored in one of the following formats: btree -- Recommended when creating and maintaining very large
maps. dbm/ndbm -- For backward compatibility. This is the default. hash -- A potentially quicker method for managing small maps. Cre-
ates a special entry with the key yp_input_file. Creates a special entry with the key yp_secure_file. This causes the makedbm command to
write a secure map. The key value ypserver looks for YP_SECURE. Creates a special entry with the key yp_output_name. Creates a special
entry with the key yp_domain_name. Creates a special entry with the key yp_master_name. If no master host name is specified, yp_mas-
ter_name will be set to the local host name. Undoes a dbm file. That is, prints out a dbm file one entry per line, with a single space
separating keys from values.
DESCRIPTION
The makedbm command takes the file specified by the argument infile and converts it to a single file or a pair of files in dbm(3),
btree(3), or hash(3) format. The dbm(3) files are stored as outfile.pag and outfile.dir. The btree(3) files are stored as outfile.btree.
Each line of the input file is converted to a single dbm record. All characters up to the first tab or space form the key, and the rest of
the line is defined as the key's associated data. If a line ends with a backslash (), the data for that record is continued onto the next
line. It is left for the Network Information Service (NIS) clients to interpret the number sign (#); makedbm does not treat it as a comment
character. The infile parameter can be a hyphen (-), in which case makedbm reads the standard input.
The makedbm command is meant to be used in generating database files for NIS. The makedbm command generates a special entry with the key
yp_last_modified, which is the date of infile.
RESTRICTIONS
You must use the same database format for each map in a domain. In addition, a server serving multiple NIS domains must use the same data-
base format for all domains.
Although a Tru64 UNIX NIS server that takes advantage of btree files will be able to store very large maps, NIS slave servers that lack
this feature might have a much smaller limit on the number of map entries they can handle. It may not be possible to distribute very large
maps from a Tru64 UNIX NIS master server to a slave server that lacks support for very large maps. NIS clients are not affected by these
enhancements.
EXAMPLES
The following example shows how a combination of commands can be used to make the NIS dbm files passwd.byname.pag and passwd.byname.dir
from the /etc/passwd file. The percent sign (%) signifies the system prompt. % awk 'BEGIN { FS = ":"; OFS = " "; }
{ print $1, $0 }' /etc/passwd > ptmp % makedbm ptmp passwd.byname % rm ptmp
The awk command creates the file ptmp which is in a form usable by makedbm. The makedbm command uses the ptmp file to create the
database files. The rm command removes the ptmp file. The following is an example of the makedb command used with the btree format
database routine to store NIS maps. makedbm -a b ...
SEE ALSO
Commands: yppasswd(1), ypmake(8)
Functions: btree(3), dbm(3), dbopen(3), hash(3), ndbm(3)
makedbm(8)