That mountpoint variable is not empty but holds "". Change the if test to
and it will fly...
EDIT: BTW, running awk 6 times per line to extract some variables is not the most efficient way to go. The read builtin command can split a line to be read into variables, like
, which will fill all those variables, given the input file is consistently well behaved. Get rid of the prefixes before the equals signs with shell "parameter expansion".
Or, adjust IFS and read the values immediately:
The _ is a dummy variable to be discarded.
With a file structure as presented, and using a recent bash with "process substitution", you could do even
, i.e source each line to have it assign all the variables miraculously automatically...
In fact I get a different (wrong) result in bash-3 for . <(echo $LINE
and identical (correct) results in all shells for . <(echo "$LINE" eval $LINE eval "$LINE"
simultaneously i want to read another file which contains df -h ouput. and want to compare the Filesystem field with $NAME field in above ouput
if both are same then i want to add remaining fields of df -h output to current ouput
Example :
if file_system:"/dev/mapper/centos-root" is equal to df -h ouput "/dev/mapper/centos-root"
then for the current ouput
mounted:"/" type:"lvm" file_system:"/dev/mapper/centos-root" i want to add remaining df -h field output.
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Hi,
I have a file like below.
1,2,3,4,5,6,7,8,9I would like to print or copied to a file based of line count in perl
If I gave a condition 1 to 3 then it should iterate over above file and print 1 to 3 and then again 1 to 3 etc.
output should be
1,2,3
4,5,6
7,8,9 (10 Replies)
Hi,
I want to read a live log file line by line and considering those line which start from time stamp;
Below code I am using, which read line but throws an exception when comparing line that does not contain error code
tail -F /logs/COMMON-ERROR.log | while read myline; do... (2 Replies)
Data:
Pattern Data Data Data
Data Data Data
Data Data Data
...
With awk, how do I print the pattern matching line, then the subsequent lines following the pattern matching line. Varying number of lines following the pattern matching line. (9 Replies)
Hi,
I have a file as below
This is the line one
This is the line two
<\XMLTAG>
This is the line three
This is the line four
<\XMLTAG>
Output of the SED command need to be as below.
This is the line one
This is the line two
<\XMLTAG>
Please do the need to needful to... (4 Replies)
$ cat file.log
Message Number = : Sending message 10:50:16^|^reqhdr.dummyid^=^02^|^reqhdr.timezone^=^GMT+05:30^|^DUMMYREQUEST^=^BH||||||||||||||||||$BD|OL|C|V||DummyAcctNo|02||24/12/2011|ST_DDM|DDM||||||||reqUUID110612105016$BT||||||||||||||||||$] Length
I have the above line in the... (4 Replies)
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
Hi all,
on Solaris 10, I'd like to print a range of lines starting at pattern but also including the very first line before pattern.
the following doesn't print the range starting at pattern and going down to the end of file: cat <my file> | sed -n -e '/<pattern>{x;p;}/'
I need to include the... (1 Reply)
Hi Experts,
Help needed on joining one line above & below to the pattern matched string line.
The input file, required output is mentioned below
Input file
ABCD DEFG5 42.0.1-63.38.31
KKKK iokl IP Connection Available
ABCD DEFG5 42.0.1-63.38.31
... (7 Replies)