Sponsored Content
Top Forums Shell Programming and Scripting awk matching script not working as expected Post 303014876 by delbroooks on Thursday 22nd of March 2018 10:44:00 AM
Old 03-22-2018
What command did you use at the command line to run the code?
Code:
gawk --lint -f awkscript4  < file1.txt file2.txt | less

prints the following:

Code:
2018-02-16 16:46:09.300 reactance 0.0004300000 2018-02-16 16:51:22.525 reactance 0.0005900000
2018-02-16 16:47:10.987 reactance 0.0002800000 2018-02-16 16:52:01.997 reactance 0.0003900000
2018-02-16 16:47:51.611 reactance 0.0006500000 2018-02-16 16:52:43.612 reactance 0.0005200000
2018-02-16 16:47:51.612 reactance 0.0006500000 2018-02-16 16:52:43.612 reactance 0.0005200000
2018-02-16 16:48:34.077 reactance 0.0006600000 2018-02-16 16:53:23.550 reactance 0.0003900000
2018-02-16 16:49:17.015 reactance 0.0003300000 2018-02-16 16:54:03.276 reactance 0.0005300000
2018-02-16 16:49:59.075 reactance 0.0000700000 2018-02-16 16:54:44.223 reactance 0.0003800000
2018-02-16 16:50:40.486 reactance 0.0002400000 2018-02-16 16:55:24.769 reactance 0.0003200000
2018-02-16 16:51:22.525 reactance 0.0005900000 2018-02-16 16:56:10.028 reactance 0.0002700000
2018-02-16 16:52:01.997 reactance 0.0003900000 2018-02-16 16:56:57.624 reactance 0.0000900000
2018-02-16 16:52:43.612 reactance 0.0005200000 2018-02-16 16:57:37.387 reactance 0.0003000000
2018-02-16 16:53:23.550 reactance 0.0003900000 2018-02-16 16:58:16.929 reactance 0.0005800000
2018-02-16 16:54:03.276 reactance 0.0005300000 2018-02-16 16:58:56.961 reactance 0.0003000000
2018-02-16 16:54:44.223 reactance 0.0003800000 2018-02-16 16:59:39.217 reactance 0.0001900000
2018-02-16 16:55:24.769 reactance 0.0003200000 2018-02-16 17:00:19.129 reactance 0.0005800000
2018-02-16 16:56:10.028 reactance 0.0002700000 2018-02-16 17:00:59.328 reactance 0.0001500000
2018-02-16 16:56:57.624 reactance 0.0000900000 2018-02-16 17:01:39.138 reactance 0.0005400000
2018-02-16 16:57:37.387 reactance 0.0003000000 2018-02-16 17:02:19.786 reactance 0.0006600000
2018-02-16 16:58:16.929 reactance 0.0005800000 2018-02-16 17:03:00.236 reactance 0.0004700000
2018-02-16 16:58:56.961 reactance 0.0003000000 2018-02-16 17:03:44.343 reactance 0.0003300000
2018-02-16 16:59:39.217 reactance 0.0001900000 2018-02-16 17:04:24.996 reactance 0.0002200000
2018-02-16 17:00:19.129 reactance 0.0005800000 2018-02-16 17:05:05.754 reactance 0.0003200000
2018-02-16 17:00:59.328 reactance 0.0001500000 2018-02-16 17:05:48.512 reactance 0.0004600000
2018-02-16 17:01:39.138 reactance 0.0005400000 2018-02-16 17:06:29.248 reactance 0.0003700000
2018-02-16 17:02:19.786 reactance 0.0006600000 2018-02-16 17:07:09.819 reactance 0.0001300000
2018-02-16 17:03:00.236 reactance 0.0004700000 2018-02-16 17:07:50.392 reactance 0.0005500000
2018-02-16 17:03:44.343 reactance 0.0003300000 2018-02-16 17:08:32.397 reactance 0.0002000000
2018-02-16 17:04:24.996 reactance 0.0002200000 2018-02-16 17:09:14.778 reactance 0.0003000000
2018-02-16 17:05:05.754 reactance 0.0003200000 2018-02-16 17:09:57.688 reactance 0.0003100000


Last edited by delbroooks; 03-22-2018 at 01:55 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

which not working as expected

Hello. Consider the following magic words: # ls `which adduser` ls: /usr/sbin/adduser: No such file or directory # Hmmm... Then: # ls /usr/sbin/adduser /usr/sbin/adduser # Now what? Unforunately this little sniippet is used in my debian woody server's mysql pre install script.... (2 Replies)
Discussion started by: osee
2 Replies

2. Shell Programming and Scripting

awk not working as expected with BIG files ...

I am facing some strange problem. I know, there is only one record in a file 'test.txt' which starts with 'X' I ensure that with following command, awk /^X/ test.txt | wc -l This gives me output = '1'. Now I take out this record out of the file, as follows : awk /^X/ test.txt >... (1 Reply)
Discussion started by: videsh77
1 Replies

3. Shell Programming and Scripting

Var substitution in awk - not working as expected

countA=`awk '/X/''{print substr($0,38,1)}' fName | wc -l` countB=`wc -l fName | awk '{print int($1)}'` echo > temp ratio=`awk -va=$countA -vc=$countB '{printf "%.4f", a/c}' temp` After running script for above I am getting an error as : awk: 0602-533 Cannot find or open file -vc=25. The... (3 Replies)
Discussion started by: videsh77
3 Replies

4. Shell Programming and Scripting

bash variable (set via awk+sed) not working as expected

Hi! Been working on a script and I've been having a problem. I've finally narrowed it down to this variable I'm setting: servername=$(awk -v FS=\/ '{ print $7 } blah.txt | sed 's\/./-/g' | awk -v FS=\- '{print $1}')" This will essentially pare down a line like this: ... (7 Replies)
Discussion started by: creativedynamo
7 Replies

5. Shell Programming and Scripting

Script not working as expected

Hi, I have prepared a script and trying to execute it but not getting expected output. Could you please help and advise what is going wrong. "If else" part in below script is not working basically. I am running it on HP-UX. for i in slpd puma sfmdb do echo "******\t$i\t*******" echo... (10 Replies)
Discussion started by: sv0081493
10 Replies

6. Shell Programming and Scripting

awk not working as expected in script

Dear all, I had script which used to work, but recently it is not working as expected. I have command line in my shell script to choose the following format from the output_elog and perform some task afterwards on As you see, I want all numbers in foramt following RED mark except for... (12 Replies)
Discussion started by: emily
12 Replies

7. Shell Programming and Scripting

awk command not working as expected

Following one line of awk code removes first 3 characters from each line but when I run the same code on another linux platform it doesn't work and only prints blank lines for each record. Can anyone please explain why this doesn't work? (31 Replies)
Discussion started by: later_troy
31 Replies

8. Shell Programming and Scripting

awk gsub not working as expected

Hi Experts, Need your kind help with gsub awk. Below is my pattern:"exec=1_host_cnt=100_dup=4_NameTag=targetSrv_500.csv","'20171122112948"," 100"," 1"," 1"," 4","400","","", " aac sample exec ""hostname=XXXXX commandline='timeout 10 openssl speed -multi 2 ; exit 0'"" ","-1","-1","1","... (6 Replies)
Discussion started by: pradyumnajpn10
6 Replies

9. UNIX for Beginners Questions & Answers

Passing Arguments to shell script from file is not working as expected.

Hi All, I have below simple shell script in cloudera quick start vm cenos 6 which copy file from source to destination. # file_copy.sh source_dir = ${source_dir} target = ${target_dir} cp source_dir target and my parameter file is like below #parameter_file.txt source_dir =... (4 Replies)
Discussion started by: Narasimhasss
4 Replies

10. UNIX for Beginners Questions & Answers

Why this script is not working as 'expected' when doing ssh with while read ... really confused?

Hi, I have a script below that is running ssh <host> <command> on some servers. Below is more or less the script. I have to modify it somehow to get rid of the 'confidential' hostnames check_log.bash #!/bin/bash # myPID=$$ parse_log () { sub="parse_log" host=${1} ... (2 Replies)
Discussion started by: newbie_01
2 Replies
lsb_release(1)						      General Commands Manual						    lsb_release(1)

NAME
lsb_release - print distribution-specific information SYNOPSIS
lsb_release [options] DESCRIPTION
The lsb_release command provides certain LSB (Linux Standard Base) and distribution-specific information. If no options are given, the -v option is assumed. OPTIONS
The program follows the usual GNU command line syntax, with long options starting with two dashes (`--'). A summary of options are included below. -v, --version Show the version of the LSB against which your current installation is compliant. The version is expressed as a colon separated list of LSB module descriptions. -i, --id Display the distributor's ID. -d, --description Display a description of the currently installed distribution. -r, --release Display the release number of the currently installed distribution. -c, --codename Display the code name of the currently installed distribution. -a, --all Display all of the above information. -s, --short Use the short output format for any information displayed. This format omits the leading header(s). -h, --help Show summary of options. NOTES
This is a reimplementation of the lsb_release command provided by the Free Standards Group. Any bugs are solely the responsibility of the author below. Detection of systems using a mix of packages from various distributions or releases is something of a black art; the current heuristic tends to assume that the installation is of the earliest distribution which is still being used by .B apt but that heuristic is subject to error. SEE ALSO
lsb(8) AUTHOR
Chris Lawrence <lawrencc@debian.org>. lsb_release(1)
All times are GMT -4. The time now is 05:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy