Search Results

Search: Posts Made By: i.scientist
5,241
Posted By i.scientist
thanks "Vi curious" for your "perl" explanation. ...
thanks "Vi curious" for your "perl" explanation.
Appreciated.

bye
5,241
Posted By i.scientist
this worked but ...can u please explain ? sorry...
this worked but ...can u please explain ?
sorry for the late response

---------- Post updated at 06:00 PM ---------- Previous update was at 05:59 PM ----------




this worked well. even...
5,241
Posted By i.scientist
print contents of file2 for matching pattern in file1 - AWK
File1 row is same as column 2 in file 2.
Also file 2 will either start with A, B or C.
And 3rd column in file 2 is always F2.

When column 2 of file 2 matches file1 column, print all those rows...
42,256
Posted By i.scientist
How to check file size before and after FTP
I want to trasfer file from

1. Unix server A to server B
2. Unix server A to windows directory

Is there a way to check the size before and after FTP.

I want to check the size of the file in...
5,111
Posted By i.scientist
radoulov and frankiln....thanks for your answers.
radoulov and frankiln....thanks for your answers.
5,111
Posted By i.scientist
Can you explain in detailed ..steps involved in...
Can you explain in detailed ..steps involved in the script ?
why should we use NR==FNR ?
Are n't they same always ? I do not know why we use it.
17,438
Posted By i.scientist
awk -F '[,]' '{ gsub(/\"| +/,"",$13);sum+=$13 }...
awk -F '[,]' '{ gsub(/\"| +/,"",$13);sum+=$13 } END { printf "Sum: 0.2%d",sum }' file

this worked. Now can i get sum of only those rows matching X1 and X2 ?

thanks for all your replies
17,438
Posted By i.scientist
Thanks, this works fine if all the columns...
Thanks,

this works fine if all the columns are included in " "
In my case they are not. Sorry for not telling that.

"1",,,,,"X1211","1",

there may be empty fields seperated by commas.
If...
17,438
Posted By i.scientist
this is not homework problem.. this is what...
this is not homework problem..

this is what i did

while read file
do
var=`echo $file | cut -f 3 -d "," | sed
....
....
done < file

but i donot wantt to use while loops

...
17,438
Posted By i.scientist
sum of all matching rows using awk
I have file
"1","x1897"," 89.10"
"1","x2232"," -12.12"
"1","x1897"," 389.10"
"1","x2232"," 212.12"
"1","x1897"," 19.10"
"1","x2232"," 2.12"


i want to add all 3 rd...
9,461
Posted By i.scientist
Thank you. Problem solved.
Thank you.

Problem solved.
9,461
Posted By i.scientist
How to delete specific files only
Hello,

I have these files in my directory.

ABC123 ABC12.sls.20080809111121
ABC233 ABC12.sls.20080403123212
ABC543 ABC12.sls.20080804231212
ABC323 ABC12.sls.20080809111232
ABC765 ...
12,545
Posted By i.scientist
It works. Thank you all for your answers.
It works.

Thank you all for your answers.
12,545
Posted By i.scientist
thanks for the solution. my problem is solved....
thanks for the solution. my problem is solved. your method looks efficient.:D

------------------------------------------------------------
echo
echo "(Versions displayed with local utility...
12,545
Posted By i.scientist
Got it!!
temp=`cat file1.dat | sed -n 1p`
while read value
do
var=`echo $value`
if [[ $var -ne "" && $var != $temp ]]
then
temp=`echo $temp,$var`
fi
done<file1.dat
echo $temp


Let me know if...
12,545
Posted By i.scientist
get the data in a file into single string
Hello everyone !

I need to get the data in a file into a string.
file1
1
2
3
4
5

I need to write a script where the file1 info is stored in a string (say variable s). So the output should...
9,644
Posted By i.scientist
How to get file2 rows ? Can I just say print $0...
How to get file2 rows ?
Can I just say print $0 in above loop ?
when i do above print $0 first file rows are printing and not second file rows.
Do i need to give the print command outside the loop...
69,412
Posted By i.scientist
I created a file say file1 And I tried this ...
I created a file say file1

And I tried this

find /mydirectory -mmin +5 -exec ls -ltr {} \;

Could not locate it. So I think Your command works.
9,644
Posted By i.scientist
it works!!!
thank you. i am not good at awk. but i can understand what you did.

can we write the output to a file ?
for example...in the same example it prints the totals. so can we say print the entire row...
9,644
Posted By i.scientist
I think I was not clear about my question. Let us...
I think I was not clear about my question. Let us say we have file1 and file2.

file1
1234
1235
1236
1237
1238
etc

file2

"1","1234","4","3",,,,,," 123.34","qw","as",...etc...
9,644
Posted By i.scientist
reading two files, comparing, printing when unmatched value is seen
Hello,
I have two files:
file1
1
2
3
4
5
file2
"a","b",,,,,"c","1",.....
"s","d",,,,,"s","1",.....
"a","c",,,,,"d","1",....
"f","v",,,,,,"f","2",.....
etc

I have to read "1" from...
7,052
Posted By i.scientist
This is the error : $ awk '!x[$1]++' file1.dat...
This is the error :
$ awk '!x[$1]++' file1.dat file2.dat > file.dat
x[: Event not found.

sort works only if the file has numbers with same digits:
I mean it will sort like this
1
2
21
23
3...
7,052
Posted By i.scientist
thanks
Awesome!!!


awk command did not work on command line, but when i put that in script and executed, it worked : any reason ?

perl worked well.



thanks.
7,052
Posted By i.scientist
found the solution
This worked....Let me know if there is a better way to do it.

sort -o file1.dat.srt file1.dat
sort -o file2.dat.srt file2.dat
comm -13 file1.dat.srt file2.dat.srt > file.dat.srt
cat...
7,052
Posted By i.scientist
To get unique numbers from two files
here i have two files:
file 1
1
2
3
4
5
5
6
7
8
9

file 2
4
5
6
6
8
8
Showing results 1 to 25 of 25

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