Hi ,
I have two files File1 and File2.In First file i have table names
abc
def
cfg
In second file i have the sql commands
for e.g
replace view def.test1 for access select * from abc.test1;
I have to find the common words from File1 and File2 and printing it in File3
the grep command i am using is
grep -o -f File1 File2|sort|uniq > File3
The problem i am facing is , if i run the above g
Hi Everyone!
I would like ask if there's a better way I can delete multiple lines in a file1 by collecting all criteria from file2.
file1:
a
b
c
d
e
f
file2:
a
e
f
The expected value will be:
b
c
d
The code below seems to work however if is taking much time when dealing with huge records.
I'm quite new to Linux and specially to the shell and all of its commands. My goal is to move some files in every directory to another directory. To be more clear, I have this:
/DIR
- /dir1
- file1
- file2
- ...
- /dir2
- file1
- file2
- ...
- ...
- /dirn
- file1
- file2
- ...
I have file1 and file2
I lookup field3 from file2 in field1 of file1 and if there is a match, output field 2,3,5 from file2.
I now want to add field2 of file1 in the output.
I suspect what I have to do is read the entire line of file1 into a 2 dim array? pls help.
If I know that file1 and file2 are the same (they are duplicates), is there anyways that I can replace file2 with a hardlink to file1? I tried to use
ln file2 file1
Is this correct? Thanks.
Hi Freinds,
i have a file1 as below
file1
Code:
1|ndmf|fdd|d3484|34874
2|jdehf|wru7|478|w489
3|dfkj|wej|484|49894
file2 contains lakhs of records and not in sorted order
i want to retrive only the records from file2 by searcing the first field of file 1
i used
Code:
grep ^1 file2 >out.txt
grep ^2 file2 >>out.txt
grep ^3 file2>>out.txt
this i need to do 3 time
I have a directory that has 800 files like this:
file1.png
file1@2x.png
file2.png
file2@2x.png
file3.png
file3@2x.png
... etc
I need to create zip files like this
file1.zip (containing file1.png and file1@2x.png)
file2.zip (containing file2.png and file2@2x.png)
file3.zip (containing file3.png and file3@2x.png)
Is there a magic command I can use to do that?
thanks.
Hi All,
I have two files in the directory
file1.txt
file2.txt
I gave ls -m > output.txt command and I got the output as
file1.txt, file2.txt, output.txt
But my output should be like
file1.txt, file2.txt
Thanks in advance.
Code:
cat file1
1 a b c
2 d e f
3 a f r
Code:
cat file2
a c e
output should be
Code:
1
3
means:
if field 1 of file2 matches filed 2 of file1 then print field 1 of file1
I know that it can be done using awk NR=FNR.
But not able to acheive it.
Thanks in advance.