Search Results

Search: Posts Made By: santosh2626
15,602
Posted By Chubler_XL
v=$(date --date "-1 hour" +"-vY=%-y -vT=%-m...
v=$(date --date "-1 hour" +"-vY=%-y -vT=%-m -vD=%-d -vH=%-H -vM=%-M")

This builds a string with current time - 1 hour eg:
-vY=13 -vT=8 -vD=12 -vH=23 -vM=4

This is used as a command line...
15,602
Posted By Chubler_XL
With this input file: ****************Start...
With this input file:

****************Start Display Current Environment **********
Host OPerating Syatem is linux, version
Java version
[8/6/13 15:10:30:000 EDT] log message
[8/8/13...
15,602
Posted By Chubler_XL
Change last line to /^[[]/&&v' infile to avoid...
Change last line to /^[[]/&&v' infile to avoid non-date lines following the first match.

I don't know why you are matching dates older than 1 hour, could you post the first line that matches...
15,602
Posted By Chubler_XL
Yes, tested with the format posted, some awk...
Yes, tested with the format posted, some awk versions require a space between -F and parameter try (notice additional space here):

v=$(date --date "-1 hour" +"-vY=%-y -vT=%-m -vD=%-d -vH=%-H...
15,602
Posted By Chubler_XL
You could try this, assuming your date command...
You could try this, assuming your date command supports --date :

v=$(date --date "-1 hour" +"-vY=%-y -vT=%-m -vD=%-d -vH=%-H -vM=%-M")
awk -F'[[ /:]' $v '
$4>Y ||
$4==Y&&$2>T ||
...
15,602
Posted By bakunin
The first problem with your code is you used...
The first problem with your code is you used single quotes: everything within single quotes is treated as is, not evaluated. This will probably work, but only find the entries with the current...
15,602
Posted By Chubler_XL
Does your date function support the --date=STRING...
Does your date function support the --date=STRING option?

e.g.

$ date --date="date -d "2/5/12 10:50:12.148 EDT"
Sun, Feb 05, 2012 10:50:12 AM
2,888
Posted By Jotne
This may need some tweak to work for you #...
This may need some tweak to work for you
# Getting the data for last hour
data_1h=$(awk '$0>=from && $0<=to' from="$(date +"["%D" "%H:%M%S -d -1hour)" to="$(date +"["%D" "%H:%M%S )" logfile)
#...
2,888
Posted By jim mcnamara
We need the format of the log - a sample will be...
We need the format of the log - a sample will be good.
12,328
Posted By balajesuri
Contradicting requirements. And surprising...
Contradicting requirements.

And surprising that cp -R didn't work.
cp -R directory1/sub1 directory2/lib
12,328
Posted By balajesuri
Like this? This one-liner will find all files...
Like this? This one-liner will find all files recursively under folder1/ and copy them into folder2/ without creating sub-folders.
find ./folder1/ -type f -exec cp {} ./folder2/ \;
2,604
Posted By Chubler_XL
If you have tar that supports -T option you...
If you have tar that supports -T option you could:

cd directory1
sed -e 's:^.*/::' -e 's/ .*//' /path/to/readme.txt | while read file
do
find ./ -name $file -print
done | tar -T - -cf - |...
2,604
Posted By Chubler_XL
Sorry missed \; on end of find statement: ...
Sorry missed \; on end of find statement:

sed -e 's:^.*/::' -e 's/ .*//' readme.txt | while read file
do
find directory1 -name $file -exec cp {} directory2/ \;
done
2,604
Posted By Chubler_XL
sed -e 's:^.*/::' -e 's/ .*//' readme.txt | while...
sed -e 's:^.*/::' -e 's/ .*//' readme.txt | while read file
do
find directory1 -name $file -exec cp {} directory2/
done
2,604
Posted By Chubler_XL
You could try this: set -- $(awk 'NR<3 {...
You could try this:

set -- $(awk 'NR<3 { sub(".*/","",$1); print $1 }' names.txt)

$1 is file1 $2 is file2
2,604
Posted By Yoda
Use Parameter Substitution...
Use Parameter Substitution (http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.baseadmn/doc/baseadmndita/korn_shell_parmsub1.htm) in Korn shell or POSIX shell:...
Showing results 1 to 16 of 16

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