Search Results

Search: Posts Made By: akshay01987
3,831
Posted By jim mcnamara
doing exactly as described: #!/bin/ksh if...
doing exactly as described:

#!/bin/ksh
if [ ! -f /data/source/a.txt ] ; then
sleep 1800 # wait 30 minutes
fi
[ -f /data/source/a.txt ] && echo 'a.txt found' || echo 'a.txt not found'...
3,831
Posted By santhoshks
Hi , Try this.. #!/usr/bin/ksh while...
Hi ,
Try this..

#!/usr/bin/ksh
while [ 1 ]
do
if [ -f /data/source/a.txt ]
then
echo " File found"
exit 0
else
sleep 30 # sleeps for 30 seconds
echo "not found "
fi
done

code...
3,831
Posted By bmk
I think you are excepting this one.. while true...
I think you are excepting this one..
while true
do
[ -f /home/oracle/test.txt ] && break
sleep 2
done
ls -l /home/oracle/test.txt
2,189
Posted By jim mcnamara
Dates are a pain. I called the file inc.pl, so...
Dates are a pain. I called the file inc.pl, so this is output. use the inc_date function

$ ./inc.pl 1999-12-31
2000-01-01
jim@jim-HP ~
$ ./inc.pl 2011-12-31
2012-01-01
jim@jim-HP ~
$...
2,404
Posted By Scrutinizer
With "doubt" you mean "question", right? Bala...
With "doubt" you mean "question", right? Bala could have put the 1 inside the single quotes, which is usually done, it does not matter. Everything in awk has the form condition{action}. If the...
2,404
Posted By balajesuri
That '1' at the end refers to print line. ...
That '1' at the end refers to print line.

See these examples to get a clearer picture:

$ cat input
earth
hello
world
mars
$
$ ### If line contains "hello", replace "ll" with "LL" and...
2,404
Posted By Scrutinizer
Doh... :D Aks, in printf formatting %-1000s...
Doh... :D
Aks, in printf formatting %-1000s means left align the argument in a field that is 1000 characters wide (If the field is wider than the argument pad with spaces).
2,404
Posted By balajesuri
Ha, ha, ha :D Scrutinizer, akshay01987 has...
Ha, ha, ha :D Scrutinizer, akshay01987 has shortened my alias name to 'bala'.

@akshay01987: '-' tells printf to pad spaces after the string. So, "%-10s" would print "hello" as "hello<5-spaces>". A...
2,404
Posted By Scrutinizer
Try: awk '/^500/{$0=sprintf("%-"w"s", $0)}1'...
Try:
awk '/^500/{$0=sprintf("%-"w"s", $0)}1' w=1000
What is bala ?
2,404
Posted By balajesuri
Something like this? awk '/^500/ {printf...
Something like this?

awk '/^500/ {printf "%-100s", $0}'1 inputfile
2,103
Posted By Scott
Hi. Something like: $ date '+%m %Y' |...
Hi.

Something like:

$ date '+%m %Y' | awk '{printf "%02d.01.%d\n", ($1-B>0)?$1:12-B+$1, ($1-B>0)?$2:$2-1}' B=8
06.01.2011
2,103
Posted By Scott
Hi. That's not the output I'd expect from a...
Hi.

That's not the output I'd expect from a non-GNUish date, but anyhoo.

Here's a quick awk one to get you started:
(B is the number of months in the past)


$ date '+%m %Y' | awk -v B=3...
2,872
Posted By Scrutinizer
Hi you can do this if grep -q '^M' file; then ...
Hi you can do this
if grep -q '^M' file; then
echo "This is a DOS file"
fi
note: you cannot copy-paste this command. The ^M is one character, entered like this on the command line CTRL-V...
1,890
Posted By ctsgnb
/^FL1/|if the scanned line begins with FL1... ...
/^FL1/|if the scanned line begins with FL1...
{x=$0|store the line in variable x
f?RS:z|if f is true (f is not empty AND f is not equal to 0) then take the value of the Record Separator, whose...
1,890
Posted By ctsgnb
nawk '/^FL1/{x=$0;printf (f?RS:z)...
nawk '/^FL1/{x=$0;printf (f?RS:z) x;f++}/^LEX/{print (f?z:x) $0;f=z}' yourfile
1,890
Posted By birei
Hi akshay01987, One way: $ cat infile ...
Hi akshay01987,

One way:

$ cat infile
FL1ABC
LEX123
FL1DDD
LEX888
LEXTHE
FL1EEE
FL1FFF
LEX555
$ cat script.awk
## When line begins with 'FL1' ...
$0 ~ /^FL1/ {
## If...
Showing results 1 to 16 of 16

 
All times are GMT -4. The time now is 11:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy