07-29-2009
A general suggestion would be:
1.) grep line 1 of both files for the characters up to the pipe character. Save each search as a separate variable.
2.) Compare both variables and if they have the same content, proceed to grep-ing the rest of the contents of line 1 of each file putting each number between pipe characters into separate variables, or even better compare them right in the loop for the desired difference. You could send the output of the loop to standard output via echo at that point...
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I have two files that I need to compare and print out the line from file2 that has the first 6 fields matching the first 6 fields in file1. Complicating this are the following restrictions
1. file1 is only a few thousand lines at most and file2 is greater than 2 million
2. I need to... (7 Replies)
Discussion started by: gillesc_mac
7 Replies
2. Programming
catch signal SIGPIPE ,print errno but it's value equal to 2(ENOENT)
#define ENOENT 2 /* No such file or directory */
is it should be EPIPE ?
#define EPIPE 32 /* Broken pipe */
Thanks ! (7 Replies)
Discussion started by: aobai
7 Replies
3. Shell Programming and Scripting
Korn Shell in AIX 6.1
I want to print the below shown pipe (|) separated list line by line.
line=es349889|nhb882309|ts00293|snh03524|bg578835|bg37900|rnh00297|py882201|sg175883
for i in line
do
echo "Hello $line "
done
I wanted to execute the above for loop. But i can't even set the... (3 Replies)
Discussion started by: polavan
3 Replies
4. Shell Programming and Scripting
Using awk, print all the lines where field 8 is equal to x
I really did try, but this awk thing is really hard to figure out.
file1.txt"Georgia","Atlanta","2011-11-02","x","","","",""
"California","Los Angeles","2011-11-03","x","","","",""... (2 Replies)
Discussion started by: charles33
2 Replies
5. Shell Programming and Scripting
how to use "awk" to print any record has pattern not equal ? for example my file has 5 records & I need to get all lines which $1=10 or 20 , $2=10 or 20 and $3 greater than "130302" as it shown :
10 20 1303252348212B030
20 10 1303242348212B030
40 34 1303252348212B030
10 20 ... (14 Replies)
Discussion started by: arm
14 Replies
6. Shell Programming and Scripting
(2 Replies)
Discussion started by: snoman1
2 Replies
7. Shell Programming and Scripting
Hello.
Using a bash script , I have a variable name for the file I want to modify
FILE_TO_EDIT="/etc/my_config_file"And I have a variable name for the parameter to change
PARAMETER="fallback_node"
PARAMETER_NEW_VALUE="http://my_server_name.com/new_path"
A config file may contain :
1°)... (2 Replies)
Discussion started by: jcdole
2 Replies
8. Shell Programming and Scripting
Hello,
I am looking for a specific situation in a text file. The conditions are,
> <CompoundName>
InChI=1S/C5H12NO2/c1-5(2)4-8-6(3)7/h5H,4H2,1-3H3/q+1
I am looking for cases where the line "> <CompoundName>" is followed by a line that contains the string "InChI=" without regard to... (5 Replies)
Discussion started by: LMHmedchem
5 Replies
9. UNIX for Beginners Questions & Answers
Hi All,
i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field.
i am using centos 7 Operating system.
want to read below file.
# cat /tmp/d5
NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies
10. Shell Programming and Scripting
For instance, my file contains the following content...
set -A array
set -A test
${array}=1
${array}=2
${array}=3
${test}="Boy"
${test}="Girl"
${test}="Dog"
x=0
while ;do
print "${array}" " " "${test}"
x=$((x+1)
done... (1 Reply)
Discussion started by: TestKing
1 Replies
LEARN ABOUT CENTOS
vgdisplay
VGDISPLAY(8) System Manager's Manual VGDISPLAY(8)
NAME
vgdisplay - display attributes of volume groups
SYNOPSIS
vgdisplay [-A|--activevolumegroups] [-c|--colon] [-s|--short] [-v|--verbose] [-d|--debug] [-h|--help] [--ignorelockingfailure]
[--ignoreskippedcluster] [--nosuffix] [-P|--partial] [--units hHbBsSkKmMgGtTpPeE] [--version] [VolumeGroupName [VolumeGroupName...]]
vgdisplay --columns|-C [--aligned] [-d|--debug] [-h|-?|--help] [--ignorelockingfailure] [--ignoreskippedcluster] [--noheadings] [--nosuf-
fix] [-o|--options [+]Field1[,Field2...]] [-O|--sort [+|-]Key1[,[+|-]Key2...]] [-P|--partial] [--separator Separator] [--unbuffered]
[--units hHbBsSkKmMgGtTpPeE] [-v|--verbose] [--version] [VolumeGroupName [VolumeGroupName...]]
DESCRIPTION
vgdisplay allows you to see the attributes of VolumeGroupName (or all volume groups if none is given) with it's physical and logical vol-
umes and their sizes etc.
vgs(8) is an alternative that provides the same information in the style of ps(1).
OPTIONS
See lvm(8) for common options and vgs(8) for options given with --columns.
-A, --activevolumegroups
Only select the active volume groups. The volume group is considered active if at least one of its logical volumes is active.
-c, --colon
Generate colon separated output for easier parsing in scripts or programs. N.B. vgs(8) provides considerably more control over the
output.
The values are:
1 volume group name
2 volume group access
3 volume group status
4 internal volume group number
5 maximum number of logical volumes
6 current number of logical volumes
7 open count of all logical volumes in this volume group
8 maximum logical volume size
9 maximum number of physical volumes
10 current number of physical volumes
11 actual number of physical volumes
12 size of volume group in kilobytes
13 physical extent size
14 total number of physical extents for this volume group
15 allocated number of physical extents for this volume group
16 free number of physical extents for this volume group
17 uuid of volume group
-s, --short
Give a short listing showing the existence of volume groups.
-v, --verbose
Display verbose information containing long listings of physical and logical volumes. If given twice, also display verbose runtime
information of vgdisplay's activities.
--version
Display version and exit successfully.
--columns|-C
Display output in columns, the equivalent of vgs(8). Options listed are the same as options given in vgs(8).
SEE ALSO
lvm(8), vgs(8), pvcreate(8), vgcreate(8), lvcreate(8)
Sistina Software UK LVM TOOLS 2.02.105(2)-RHEL7 (2014-03-26) VGDISPLAY(8)