Search Results

Search: Posts Made By: sandy1028
2,853
Posted By sandy1028
GMT to PST
99.60.97.205 - - [26/Mar/2011:06:00:00 +0000] GET /2009-03-29/world/impact.row.atlantic_1_rower-paul-ridley-cancer-research?_s=PM:WORLD HTTP/1.1 200 9386 www.abc.com ...
4,002
Posted By sandy1028
check the file size
if [ -s /tmp/testfolder/*.* ]; then
cp /tmp/testfolder/*.* ~/new/logs/
else
echo "No files today"
exit
fi



The problem is this doen't work when there is more than 1 file....
1,996
Posted By sandy1028
Parse the log file
./abc.sh started at Sun Oct 24 06:42:04 PDT 2010

Message:
=======
Summary Report of NAME count
-----------------------------------------------------------------
Below is the output of the SQL...
2,438
Posted By sandy1028
Remove tab
Hi,

I have a file and it is tab delimited.
I have to remove the tab and add space after the string "GET" if tab it exists.
1,172
Posted By sandy1028
find and replace
find . -type f -exec sed -i 's/000/333/' {} \;
grep -A 1 'height' filename

How to modify the command and replace only strings which is below the line which contains the string "height"
If the...
2,071
Posted By sandy1028
I have a tab delimited file(as mentioned...
I have a tab delimited file(as mentioned above),which contains the timestamps entries for 2 days,(Aug 21st and Aug 22nd) in which 4th column is the timestamps.
I have to sort the file based on...
2,071
Posted By sandy1028
67.162.10.216 - - ...
67.162.10.216 - - [21/Aug/2010:00:00:00 +0000] GET /2010-08-18/news/ct-met-barrington-student-death-20100818_1_mental-illness-suicide-prevention-teen-suicides HTTP/1.1 200 ...
2,071
Posted By sandy1028
Sed command
I have a file a.txt which contains the date and time.
22/Aug/2010:02:03:00
21/Aug/2010:00:00:00
21/Aug/2010:00:02:00
22/Aug/2010:00:00:00
22/Aug/2010:01:00:00
22/Aug/2010:02:00:01...
1,492
Posted By sandy1028
Convert date
If I pass the value in the form YYYY/MM/DD(20100719) how to convert in the form 19\/Jul\/2010
4,222
Posted By sandy1028
Thanks, But how to use in the below command ...
Thanks, But how to use in the below command

awk -F"\t" -vv1=$name 'BEGIN{OFS="\t"} {gsub ("http://www."v1".com","",$6);print $1,$8*1000000}' abc.tsv > tmp
4,222
Posted By sandy1028
exponential format
awk -F"\t" -vv1=$name 'BEGIN{OFS="\t"} {gsub ("http://www."v1".com","",$6);print $1"\t-\t-","["$4,$5"]",$6,$7,$9,$2,$14,$15"\t""Apache=-\t-",$8*1000000"\t-\t-\t-\tdeflate=-\trmt=-"}' file.txt > a.txt...
1,586
Posted By sandy1028
When i executed the command, awk 'NR>1 {for...
When i executed the command,

awk 'NR>1 {for (i=1;i<=NF;i++) if ($i!=0) a++}END {if (a>0) print a, "not all the values in file are zero"}' urfile

2 not all the values in file are zero

I have...
25,148
Posted By sandy1028
check if directory and file exists
cp $PATHLOGS/$DATE/*.* $TMP/logs_tmp/
cp $PATHLOGS/$DATE1/*.* $TMP/logs_tmp/



Before copying the files I have to check if the directory $DATE1 and $DATE2 exists.
If directory exists then,...
1,586
Posted By sandy1028
Check values in file
Hi,

I have a tab delimited file in which first row is the header and others rows has the values.

A B C D
2 4 0.00 3.00
0.00 9.78 4654 898

I have to check whether all the values are zero.
...
5,070
Posted By sandy1028
yesterday's date
curdate=$(date +"%d-%b-%y")



How to get the yesterday's date.
1,221
Posted By sandy1028
Find and replace
In a directory I have many XML files, how to search for the string
<text>You are here</text> and replace it with
<text>YOU Are HERE</bc-text> in a unix command

find . -name "*.xml"
1,373
Posted By sandy1028
DATE=`./get_date.pl 3 date` ...
DATE=`./get_date.pl 3 date`
DATE1=`./get_date.pl 2 date`

The variable DATE and DATE1 will print ' 6/Jul/2010' and ' 7/Jul/2010' assuming current date is '9/Jul/2010'

The below part of the code...
1,373
Posted By sandy1028
var1='6\/Jul\/2010' var2='7\/Jul\/2010' ...
var1='6\/Jul\/2010'
var2='7\/Jul\/2010'

var1='6/Jul/2010'
How to make it '6\/Jul\/2010'
Please tell me how to escape the "\" in shell script.
1,373
Posted By sandy1028
Use of variable
sort -k2 tmp.tsv | sed -n '/\[6\/Jul\/2010:06:00:00/,/\[7\/Jul\/2010:09:00:00/p' > tab.tsv

If I use the hard coded values it works fine.

How to use the variable in place of date.

value of...
3,538
Posted By sandy1028
Add zero in decimal number
echo "scale=2; 282.73/640" | bc


This will print .44

How to make the variable as 0.44
2,077
Posted By sandy1028
Remove space
DATE=6/Jul/2010
6/Jul/2010
var="sed -n '/\[$DATE:06:00:00/,/\[${DATE1}:09:00:00/p"
echo $var

sed -n '/\[ 6/Jul/2010:06:00:00/,/\[ 7/Jul/2010:09:00:00/p

Please tell me how to remove the space...
3,000
Posted By sandy1028
sed -n...
sed -n '/[5\/Jul\/2010:06:00:00/,/[6\/Jul\/2010:09:00:00/p' soredfile.tsv > output
sed: -e expression #1, char 50: unterminated address regex


b [5/Jul/2010:07:00:10
a ...
1,059
Posted By sandy1028
date format
When I execute the perl script from shell script I get the output as
date1=./get_date.pl 3
20100706

How to convert it to 6/Jul/2010 format
3,000
Posted By sandy1028
Thanks, If the input file is b ...
Thanks,

If the input file is


b 05/Jul/2010:07:00:10
a 05/Jul/2010:06:00:09
b 05/Jul/2010:07:00:10
c 05/Jul/2010:07:10:16
d 05/Jul/2010:08:00:10
e 05/Jul/2010:09:00:10...
1,829
Posted By sandy1028
Sort the multi column rows
abc [5/Jul/2010:00:59:59 +0000]
xyz [5/Jul/2010:00:10:00 +0000]
- [5/Jul/2010:06:10:00 +0000]
- [5/Jul/2010:06:50:00 +0000]
- [5/Jul/2010:07:10:00 +0000]
- ...
Showing results 1 to 25 of 83

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