Hi,
Can somebody help me?
I am testing a demo with the given function
Now, the "PATH525" has following content
And I was expecting the final result should be all files except the duplicates. (by duplicate, I mean the occurance of *3*)
But is it not working
I get the content of the "DataFileName" as : Whereas I WANT IS FOLLOWING
Also please take notice of the fact that in case of DUPLICATION of file, I would LIKE TO HAVE BIGGER SIZE FILE TO BE IN DATAFILENAME file
So you want to consider chars 1 - 7 of the filename only in order to find "duplicates" (No two or more digit integers possible?), and, if found, use the larger size file name?
I don't see any attempt to use either criterion in your code snippet? BTW, vgtee_1 would be a duplicate as well, wouldn't it?
Hi,
Yeah you are right.
Now, I manage to do what I wanted. Following is the code snipet for that
well, it is bit lengthy as I am beginner with script. But it works fine for me..
And about the "vgtree_1", I would prefer the
with large file size.
thanks
emily,
---------- Post updated at 08:40 AM ---------- Previous update was at 06:04 AM ----------
Quote:
Originally Posted by RudiC
So you want to consider chars 1 - 7 of the filename only in order to find "duplicates" (No two or more digit integers possible?), and, if found, use the larger size file name?
I don't see any attempt to use either criterion in your code snippet? BTW, vgtee_1 would be a duplicate as well, wouldn't it?
Hi RudiC,
yes you are right, occurance of *1* is also duplication.
And now, the problem I am facing is following. The code snippet that I showed in my following mail is working fine but it leave a blank row on the top. I wonder if that can be removed somehow.
I would get the wrong results because of that.
The following will do the job if run in the target directory; it works on my linux/bash/mawk system:
You may want to add the full path to the output as you did in your own example.
The following will do the job if run in the target directory; it works on my linux/bash/mawk system:
You may want to add the full path to the output as you did in your own example.
Hi,
yes thats wat I want with the full path. But the issue is that $FileName has first row as blank. I do not want that. So is there any way to avoid such blank row in the $FileName.
Not sure. $filename is appended to in your loop. Did you remove the file before it is written to in the loop? You also may want to analyse the output of the
before awk'ing it to $filename. And, how do you compose $filename? It may point to an unexpected target...?
Je t'en prie!
P.S.: you can use head and tail to remove lines from files, but this should be considered a last resort.
Last edited by RudiC; 10-28-2012 at 11:54 AM..
Reason: ultimate idea
Not sure. $filename is appended to in your loop. Did you remove the file before it is written to in the loop? You also may want to analyse the output of the
before awk'ing it to $filename. And, how do you compose $filename? It may point to an unexpected target...?
Je t'en prie!
Hi,
Yes, I do remove the file before it is written.
I define it variable in the mail script as
FileName=DataFileName
If the content of the File0_1 is blank, my script wont run further. So anyhow, I will get WARNING Message. but yes, I should make it bit robust.
I guess, I answered he last question.
Hey,
I have number of .tgz files and want to extract the file with the ending *results.txt from each one.
I have tried
for file in *.tgz; do tar --wildcards -zxf $file *results.txt; doneas well as
list=$(ls *.tgz)
for i in $list; do tar --wildcards -zxvf $i *.results.txt; done... (1 Reply)
consider the following is the contents of the file
cat 11.sql
drop procedure if exists hoop1 ;
Delimiter $$
CREATE PROCEDURE hoop1(id int)
BEGIN
END
$$
Delimiter ;
.
.
.
.
drop procedure if exists hoop2;
Delimiter $$
CREATE PROCEDURE hoop2(id int)
BEGIN
END
$$ (8 Replies)
Hello there,
I am trying to extract (string) information ( a list words) from 4 files and then put the results into 1 file. Currently I am doing this using grep -f list.txt file1 . and repeat the process for the other 3 files. The reasons i am doing that (a) I do know how to code (b) each file... (4 Replies)
Hi Everyone,
I'm really new to all this so I'm really hoping someone can help. I have a directory with ~1000 lists from which I want to extract lines from and write to new files. For simplicity lets say they are shopping lists and I want to write out the lines corresponding to apples to a new... (2 Replies)
Hi,
I have several files that look like this:
File1.txt
Data1
Data2
Data20
File2.txt
Data1
Data5
Data10
File3.txt
Data1
Data2
Data17
File4.txt (6 Replies)
hi everyone!
I'd like to extract a single column from 5 different files and put them together in an output file. I saw a similar question for 2 input files, and the line of code workd very well, the code is:
awk 'NR==FNR{a=$2; next} {print a, $2}' file1 file2
I added the file3, file4 and... (10 Replies)
hi everyone!
I already posted it in scripts, I'm sorry, it's doubled
I'd like to extract a single column from 5 different files and put them together in an output file. I saw a similar question for 2 input files, and the line of code workd very well, the code is:
awk 'NR==FNR{a=$2; next}... (1 Reply)
Hi,
I have 20 files which have respective 50 lines with different values.
I would like to process each line of the 50 lines in these 20 files one at a time and do an average of 3rd field ($3) of these 20 files. This will be output to an output file.
Instead of using join to generate whole... (8 Replies)
so i have hundreds of files named history.20071112.tar
(history.YYYYMMDD.tar)
and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis
here is what i have so far:
for FILE in `cat dirlist`
do
tar xvf $FILE ./status_*
done
dirlist is a text... (4 Replies)