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'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
- ...
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 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.
Hi.,
I want to edit/replace strings into file.txt( or )file.cfg in middle of file with oldstring,using awk or sed command in shell script.
I am new to shell script ,here my sample example.
File1:
aaa.c
bbb.c
ddd.c
eee.c
file2:
aaaaaaaaaaaaaaaaaaa
dddddddddddddd
INPUT
ccccccccccccc
dddddddddddddd
want to replace INPUT as aaa.c bbb.c ddd.c eee.c
tried the below c
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.
Hi , i am newbie to shell scripting and am trying to do the below job,
A shell script to be run with a command like
sh Compare.ksh file1.txt file2.txt 1 2 > file3.txt
1 2-are the key columns
Consider the delimiter would be Tab or comma
File 1:
SK TEST NAME MATHS PHYSICS
21 1 AAA 45 65
21 2 AAA 48 66
22 1 BBB 46 64
22 2 BBB 47 65
23 1 CCC 58 85
23 2 CCC 59 88
File 2:
SK TEST NAME MATHS P
Hi , i am newbie to shell scripting and am trying to do the below job,
A shell script to be run with a command like
sh Compare.ksh file1.txt file2.txt 1 2 > file3.txt
1 2-are the key columns
Consider the delimiter would be Tab or comma
File 1:
SK TEST NAME MATHS PHYSICS
21 1 AAA 45 65
21 2 AAA 48 66
22 1 BBB 46 64
22 2 BBB 47 65
23 1 CCC 58 85
23 2 CCC 59 88
File 2:
SK TEST NAME
I have two files like this
file1
a
b
c
file2
0
1
2
I want to output
a,0
b,1
c,2
Appending the two files like this
row(n) of file1 +","+ row(n) file2 for every n, total n is same in both files
I want to know is there any utility in shell which can help me do this, I do not want to use java file read file write for this or any loops. Can it be done using awk?