preserving last read value in shell script
Dear ALL,
Here are the contents of the file 1600 1900 2200 2800 I want to read file content using shell script and check if the difference between the two line count is 300 With regards, Keerti |
Hi,
Code:
#!/bin/bash |
Or another option:
Code:
awk 'NR > 1{printf "Difference is %s300\n",($0 - x == 300)?"":"not "}{x = $0}' file |
Thanks
Thanks druuna,it worked for me
|
You're welcome :)
|
I created a script named readfile and a test data file named testdata. Testdata contains all the data in your sample.
Code:
#!/bin/bash Hope this helps! Roger |
All times are GMT -5. The time now is 03:42 AM. |