Hi,
I have a value stored in x and I need to compare it to the numbers in every other line of a file. The file contains alternating lines of numbers and letters:
aaaa1111
AAAAAAAA
bbbb2222
BBBBBBBB
cccc3333
CCCCCCCC
I need to compare x to the numbers in every other line without the first four characters of that line. So I want to compare x to 1111, then to 2222, then 3333.
$ tail -f /logs/filename.log | awk '!(/list)'
I am able to run this command in GNU Linux flavour
But when I written in a script it is not working.
test.ksh:
variable="/logs/filename.log | awk '!(/list)'"
tail -f $var
Getting the error as
tail: cannot open `|' for reading: No such file or directory
tail: cannot open `grep' for reading: No such file or directory
tail: cannot open `list' fo
If you have a look at this thread, you'll see that users have been posting the output a script which are numbers that range from 2 to 5 decimal places.
Please consider the following example:
$ grep --color=always -n 'Format\|Files' /usr/share/doc-base/doc-base | less -R
Here, grep will color also the line numbers of the matches, and less will display it.
I have a file with many numbers, with each number on one line.
Hi,.
I am writing a script to get the new files and split them.
Requirement
Find the new files under the path "/wload/scmp/app/data/OAS" (There are 5 sub folders).
I have this simple script which redirects the output and append it to a file.
filename="/home/ronnie/tmp/hello"
date=$(date)
echo "$date" >> $filename
Now, lets suppose I change date=$(date) to date= $(date) which will generate an error.
Log files are important when debugging or just to check how a system is performing, we usually use cat to list the log on the screen, but if we want to see a live view of the log file, the command is:
tail -f /var/log/logfile.log
I have the following bash script lines in a file named test.sh.
Code:
#!/bin/bash
#
# Write Date to cron.log
#
echo "Begin SSI Load $(date +%d%b%y_%T)"
#
# Get the latest rates file for processing.
#
d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1)
filename=$d
export filename
echo "The file name is $filename."
When I execute ./test.sh