06-21-2013
Well, 'paste' is OK for identically keyed and sorted files, but 'join' is a more general solution (with sort to ensure it is key sorted, sometimes needing LC_ALL=C to make sort binary). Or awk could store one file in an associative vector and then look the right lines up to match with the lines of the second file, sort order not an issue but you need unique keys in file 1, as it a only a one to many join.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I want to replace the contents of a file.I tried using :
sed 's/01514581/01514582/' $p
where 01514581 is the original value
01514582 is the replaced value
$p is the file name (captured in a variable)..
The output does not recognise $p
If you give :
sed... (2 Replies)
Discussion started by: shiroh_1982
2 Replies
2. Shell Programming and Scripting
I have 2 files
file1
1 TMQUEUE QUE1 STMW633A
100 DMADM DOMGRPSTMW633A STMW633A
100 GWADM GWTGRPSTMW633A STMW633A
100 GWADM GWTGRPSTMW633AA STMW633A
100 GWADM GWTGRPSTMW638A STMW638A
100 TMSYSEVT EVTGRPSTMW633A STMW633A
100 TMSYSEVT ... (2 Replies)
Discussion started by: kaustubh137
2 Replies
3. Shell Programming and Scripting
Hi
I have a file that looks like this:
Line 0
animal elephant
Line 1
animal elephant
Line 2
animal elephant
Line 3
animal elephant
What i am aiming to do is with a script and an input value of... (6 Replies)
Discussion started by: tara
6 Replies
4. Shell Programming and Scripting
From the existing file, I need to replace specific contents possibly with var every time when the user changes the var.
e.g the contents in the file file.txt is 'My name is $n and I am $y years old' and every time user changed the var outside the file, the contents of the file should be created... (4 Replies)
Discussion started by: Emilywu
4 Replies
5. Shell Programming and Scripting
Hi All,
Need help on this
I have 2 files
one file file1 which has several entries as :
define service{
hostgroup_name !host1,!host5,!host6,.*
service_description check_nrpe
}
define service{
hostgroup_name !host2,!host4,!host6,.*
service_description check_opt
}
another... (2 Replies)
Discussion started by: namitai
2 Replies
6. Shell Programming and Scripting
Hi,
I am facing issue while reading data from a file in UNIX. my requirement is to compare two files and for the text pattern matching in the 1st file, replace the contents in second file by the contents of first file from start to the end and write the contents to thrid file.
i am able to... (2 Replies)
Discussion started by: seeki
2 Replies
7. Shell Programming and Scripting
Hi Friends,
I have a file1 with 5 columns
a b c d e
f g h i j
I have file2 with 3 columns
1 2 3
4 5 6
I want to replace 3rd 4th and 5th columns in file1 with file2 contents, so the output would be
a b 1 2 3
f g 4 5 6
Thanks (6 Replies)
Discussion started by: jacobs.smith
6 Replies
8. UNIX for Dummies Questions & Answers
How can i replace the contents in a particular line of a file.
<FOLDERMAP SOURCEFOLDERNAME="FFCB-2012" SOURCEREPOSITORYNAME="Repo_DEV" TARGETFOLDERNAME="TEST" TARGETREPOSITORYNAME="Dev_Repo"/>
For Example I want to replace the SOURCEREPOSITORYNAME="Repo_DEV" to... (3 Replies)
Discussion started by: Ariean
3 Replies
9. Shell Programming and Scripting
Hello,
I need help to replace a value by a new one.
I've got a script, that will get directory size in ko, then write the size value return in a log file :
The patch is given in crontab, and use with $1 in the script.
I am looking for help to replace, after: the old value without to... (6 Replies)
Discussion started by: Aswex
6 Replies
10. Shell Programming and Scripting
Hello,
I have two files: file1 and file2
file1 has the following info:
---
host: "localhost"
port: 3000
reporter_type: "zookeeper"
zk_hosts:
- "localhost:2181"
file2 contains an IP address (1.1.1.1)
What I want to do is replace localhost with 1.1.1.1, so that the... (4 Replies)
Discussion started by: Jay Kah
4 Replies
LEARN ABOUT HPUX
hp9000s200
machid(1) General Commands Manual machid(1)
NAME
machid: hp9000s200, hp9000s300, hp9000s400, hp9000s500, hp9000s700, hp9000s800, hp-mc680x0, hp-pa, pdp11, u370, u3b, u3b10, u3b2, u3b5, vax
- provide truth value about processor type
SYNOPSIS
DESCRIPTION
The following commands return a true value (exit code 0) if the a processor type matches the command name. Otherwise a false value (exit
code nonzero) is returned. These commands are commonly used within makefiles and shell procedures to improve portability of applications
(see make(1)).
+-----------+-------------------------++--------+--------------------------+
|Command | True for ||Command | True for |
+-----------+-------------------------++--------+--------------------------+
|hp9000s200 | Series 200 ||pdp11 | PDP-11/45 or PDP-11/70 |
|hp9000s300 | Series 300 ||u3b | 3B20 computer |
|hp9000s400 | Series 400 ||u3b2 | 3B2 computer |
|hp9000s500 | Series 500 ||u3b5 | 3B5 computer |
|hp9000s700 | Series 700 ||u3b10 | 3B10 computer |
|hp9000s800 | Series 800 or 700 ||u370 | IBM System/370 computer |
|hp-mc680x0 | Series 200, 300, or 400 ||vax | VAX-11/750 or VAX-11/780 |
|hp-pa | Series 700 or 800 || | |
+-----------+-------------------------++--------+--------------------------+
EXAMPLES
Given a shell script that must behave differently when run on an HP 9000 Series 700 or 800 system, select the correct code segment to be
executed:
WARNINGS
always returns true on both Series 800 and Series 700 systems. Therefore, when using this command in scripts to determine hardware type,
always use both and in the appropriate sequence to ensure correct results (see
machid(1) will no longer provide support for future machines beyond the Series 800 and Series 700 systems. Decisions should be based on
the hardware and software configuration information returned by getconf(1).
SEE ALSO
getconf(1), make(1), sh(1), test(1), true(1).
machid(1)