Search Results

Search: Posts Made By: amarn
1,689
Posted By Corona688
Doesn't work that way. It wouldn't have a real...
Doesn't work that way. It wouldn't have a real file name, in any case; it'd try to open a file and complain that it didn't exist.

A named pipe may be useful. It'll effectively be a file my_tool...
5,318
Posted By Yoda
The code that you posted was actually comparing...
The code that you posted was actually comparing 2nd field in file2 with 2nd field in file1:
awk 'NR==FNR{a[$2]=$0;next}a[$2]{$0=a[$2]}1' file2 file1
But your requirement was to compare it other...
5,318
Posted By Yoda
Try this: awk 'NR==FNR{A[$2];next}$2 in A'...
Try this:
awk 'NR==FNR{A[$2];next}$2 in A' file1 file2
4,467
Posted By tukuyomi
?_? ~/unix.com$ cat file1 00AB01/11 ...
?_?
~/unix.com$ cat file1
00AB01/11
43TG22/00
78RC09/34
~/unix.com$ cat file2
78RC09/34 1
45FD11/11 2
00AB01/11 3
43TG22/00 4
~/unix.com$ awk 'NR==FNR{A[$1]=$2;next}$0=$1 OFS A[$1]' file2...
2,114
Posted By Chubler_XL
You could try this: for num in {1..400} ...
You could try this:

for num in {1..400}
do
echo "Processing directory #${num}"
cd /home/my_dir/hour_${num}
dos2unix -q -n hour_${num}.txt tmp.txt
paste tmp.txt...
10,693
Posted By CarloM
EDIT: What felipe said :). So this should...
EDIT: What felipe said :).

So this should work:
find /home/tester/datasets/ -name "hour_*.txt" -type f | \
while read fname
do
fileBaseName=`basename "${fname}"`
fileDirName=`dirname...
10,693
Posted By felipe.vinturin
The problem is because awk's FILENAME points to...
The problem is because awk's FILENAME points to the filename and path, not only the filename!

Try to change FILENAME to:

# E.g. awk '{ns=split(FILENAME, arr, "/"); print arr[ns]}' <infile>
#...
1,887
Posted By felipe.vinturin
Please, execute the command below: find...
Please, execute the command below:

find /home/dataset -maxdepth 1 -name "hour_*.txt" -type f


I think it is an environment issue, because some "find" command distributions does not accept the:...
1,440
Posted By Franklin52
One way: awk 'FNR>2{print > "new_" FILENAME}'...
One way:
awk 'FNR>2{print > "new_" FILENAME}' *
2,130
Posted By Franklin52
Something like this? awk '{print > "new_"...
Something like this?
awk '{print > "new_" FILENAME}' RS=" " file*.txt
Forum: Programming 10-09-2011
16,674
Posted By radoulov
No, this is not a Cygwin issue. Consider the...
No, this is not a Cygwin issue.

Consider the following (rigth now, I'm on Cygwin too):

This is the content of the two input files: file1 and file2:

% head file[12]
==> file1 <==
1 ...
Showing results 1 to 11 of 11

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