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.
My goal is to extract those lines in File1 which are not present in File2
Let's say File1:
String A
String B
String C
Let's say File2:
String B
String C
Lines are sorted and my output should be:
String A
So I wrote this command for it:
diff File1 File2 | grep '^<' | sed 's/< //g'
which worked fine for my sample files with 10 - 20 lines.
I also tried this command:
grep -Fxv -f
Hello,
I have a text file which contains a list of strings which I want to grep from another file where these strings occur and print out only these lines.
I had earlier used the grep command
Quote:
grep -f File1 File2
where File1 was the file containing the strings to be grepped (Source File) and File2 the Target File from which the strings ha
I have a directory full of files ending with different extensions, how would I list/select only the files ending with .in and corresponding .out that share the same basename?
e.g.
file1.txt
file1.in
file2.in
file3.in
file2.out
file3.out
What I want to select from these files are:
file2.in
file2.out
file3.in
file3.out
Hello every one,
I have two files : file1 and file2
- file1 contains one column and multiple lines.
- file2 contains multiple lines and multiple columns.
I want to do a script that compare the first column of file2 with the only column of file1 then took the lines that are the same and search for each line the whole line on file2 then write the result on a file that we can call RESULT.
Here is
How do I keep a file pattern from evaluating?
I want to pass in a file pattern to a script as a parameter, and then use that pattern in subsequent statements, but I can't get the pattern to not evaluate before I use it.
For example, if I have 3 files called file1.txt, file2.txt and file3.txt and in my script I have something like this:
num=`ll $1 | wc -l`
and I pass file*.txt in as my para
I want to compare two files. I think using grep is the way to go but I do not know how to set this up. Let me show an example:
File1 has 1000 items, File2 has 700 items
I need to take the first item in File1 and search the entire contents of File2 to see if there is a match there. IF there is a match (meaning the same item is in both File1 and File2) then do nothing.
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.