Ubuntu :: Finding Intersect Of Lines In Files?
Aug 3, 2010
I have several text files that list hundreds or thousands of words each. I need to find the intersect of each of these sets. (i.e. print only lines that occur in each file) Is there a CLI utility that can do this?
View 3 Replies
ADVERTISEMENT
Aug 7, 2010
I know how to use grep to output a line that matches a string. But what if I also want to output one line above every line containing a matching string, how do I do that?
View 1 Replies
View Related
Dec 26, 2010
I have a text file that each contains either a domain or an IP, like this:
Code:
[me@server ~]# cat file1
122.foo.com
yahoo.com
23345229.com
[code]....
I want to remove all IPs in that file and keep others, so the result be like:
Code:
[me@server ~]# cat file2
122.foo.com
yahoo.com
23345229.com
[code]....
View 6 Replies
View Related
May 23, 2011
Is there a cc cleaner equivalent for linux to clear out tmp, internet files, etc.?
View 9 Replies
View Related
May 23, 2011
Is there a program for Ubuntu that converts AVI files to VOB files? This is the only type of file that will burn to a DVD and successfully play on my DVD player. I can use DVD Flick on Windows but I'm sure this can't be the only way. There has to be a way to get VOB files on an Ubuntu operating system.
View 4 Replies
View Related
Jun 30, 2011
How to see the first/last lines in a zip file (like head/tail commands)? The zip file only contains one file of big size.
Also, is it possible to read the lines from the zipped file one by one in C++ programming?
It's not a good idea to unzip it first due to its big size.
View 3 Replies
View Related
Jan 17, 2011
Usually when I need to replace some lines in a file, the first tool that comes to mind is sed -i:
sed -i 's|tool:.*|tool: some-tool|'
However, it's inconvenient when there are . characters in the replacement string:
sed -i 's|host:.*|host: 127.0.0.1|' Is there a better tool for this case?
View 1 Replies
View Related
Nov 5, 2010
Is there a way, besides writing a PERL program, to read each line one by one in file A and tell if this line also exists in file B? Can this be done via a shell script?
View 6 Replies
View Related
Sep 17, 2009
Is there anyway to delete certain paragraphs within a text file and then insert the paragraph into another text file.I just cannot figure out how to remove the specific lines from the file and then insert them into another file at a certain line within that new file. Thanks again
View 10 Replies
View Related
Mar 10, 2010
i try do modify BASHRC and ENVIRONMENT files on directory ETCthen all the command don't work, such as:SUDO, GEDIT, NAUTILUS, NANO and some others!now i want to edit the 2 files and delete the insert lines
View 9 Replies
View Related
Jul 5, 2011
I want to count the lines of all files in this directory and all its subdirectories, but exclude directories "public", "modules", and "templates".
View 2 Replies
View Related
Aug 22, 2009
eed to make a script to append a line to the bottom of multiple files (only certain files, but 100's spread over directories).Doing a find replace inside multiple files is easy, I use the followingfind /base/dir -name "*.txt" -exec perl -pi -w -e 's/FIND/REPLACE/g;' {} ;So I tried doing the followingfind /base/dir -name "*.txt" -exec echo "Append this" >> {} ;However this just appends all the text into a file called "{}". Whereas {} should be replaced with each file that's found.
View 1 Replies
View Related
Jul 21, 2011
in the shell. how do i compare 2 text files and change matching lines in one of the files ?
example:
cat file_1.txt
line_1
[code]...
View 6 Replies
View Related
Aug 25, 2010
I've been trying to sort this out for several hours and I?m totally lost? I?ve been searching around, but haven?t found the solution to my problem. I have a directory with 100 files. I need to copy 10 lines of each files (let?s say from line 45 to 55) into one unique file. So I guess I could use sed ?w, but I didn?t manage to write the right script. I also tried using a loop to create 100 different files, each one with the 10 lines) to concatenate them later on. But I only got 1 file, not 100.
View 12 Replies
View Related
May 31, 2011
I've just installed Kubuntu 11.04, switched on wobbly windows effect. It runs very smooth on my Nvidia GeForce 7600 GS with dual screen twinview turned on. However, I get these lines when I drag/move the window upwards - see screenshot:
View 6 Replies
View Related
Apr 3, 2010
I'm searching within Java files for some occurrence of a phrase:
find . -name '*.java' | xargs grep -l 'string'
How do I change this command to print to the shell all of the lines which contain a match?
View 4 Replies
View Related
Mar 20, 2011
I'm running a find. -name pattern to find some files, and I'd like to elegantly get the total number of lines in these files. How can I achieve that?
View 4 Replies
View Related
Sep 7, 2010
I am facing a problem while splitting a text file, I need to split a file into some parts and each split file should have 2000 lines, when I do it through "split" command the mother file is kept intact but as per my requirement I need to cut mother file into some parts thus it should not be kept intact.
Example:
file size
motherfile.txt 5000 lines.
after split
motherfile.txt 2000 lines.
childfile1.txt 2000 lines.
childfile2.txt 1000 lines.
View 7 Replies
View Related
May 13, 2011
My server was hit with an injection script which has placed code across many of my clients files. I need a script that can remove a block of php code that spans multiple lines, multiple directories/files and is dynamic, meaning that part of the code changes. I think using find/sed is what I need but cannot seem to figure out how to get it to work.The following is the script that is being injected everywhere. The catch is that they have generated dynamic code at the start/end of the script. (I have commented the parts that are dynamically changing on EVERY instance).PLEASE NOTE: Directly following this script is the start of a valid php script that I do not want to delete.
<?php
//{{65281980 - DYNAMIC!!
GLOBAL $alreadyxxx;
[code]...
View 2 Replies
View Related
Mar 26, 2010
i tried using diff --GTYPE-group-format= with <%, but not sure that right solution.Here's what im trying to do. I have two c source files, file1 and file2. file1 has a function in it that's been modified in file2. However, the functions begin at differnt line numbers in eachof the files. Is there a way to specify a range of file numbers on file1 and file2 to compare, using diff or any other combination of utilities? I can always output text from a range of lines from each file to two separate and new files and then compare those, but that's tedious. I could also write up a script to automate this type of solution, but I imagine there's an existing way of doing this.
View 1 Replies
View Related
May 1, 2010
I have is that I can't update anything at all, my update manager isn't working because I created a few internet files in my /etc/ somewhere so that I could use the internet through a wingate network and now I need to get rid of those files because I'm on a direct connection now. I'm running Intrepid Ibex. .
View 8 Replies
View Related
Jun 3, 2010
were do i get the .dev files for libx264 0.98 i think is the version it is asking for.I install the latest libx264 from git or does that install the .dev file also.
View 3 Replies
View Related
Jul 7, 2011
I have two text files in the form:1 ItemA [value]2 ItemB [value]3 ItemC [value]Some of these items are common for both files, while others are missing from either one or the other.I want to compare the values for each common item in the two lists, but don't know how. I have a vague idea that probably grep might be useful, but I don't know how to use it for this purpose.So, to sum it up, what I would like to do is to take to text files containing lists and merge their common items into a third file in the form:
1 ItemA [value_from_list1] [value_from_list2]
2 ItemB [value_from_list1] [value_from_list2]
3 ItemC [value_from_list1] [value_from_list2]
[code]....
View 2 Replies
View Related
Apr 27, 2010
I want to (from the command line) be able to counte lines in a bunch of files of a specific type in a folder and all its sub-folders. How would I do this?
View 1 Replies
View Related
Apr 22, 2011
I have been experiencing a problem where the screen loads and after initial first few lines breaks up into multiple repetitions of lines. Reloading helps but has to be repeated when pageing down. Mail is no problem; it is supplied by my network provider. OS is openSUSE 11.2 which I update when advised. Below is a sample from the error console:
[Code]...
View 1 Replies
View Related
Nov 24, 2009
How do you remove parts of strings using python? Such as, if I have something like:
Code:
erme1 sdifskenklsd
erme2 sdfjksliel
[code]....
View 3 Replies
View Related
Mar 12, 2011
I have a situation where a directory has about 1.5 million files in it. On an hourly basis, I want to be able to find any files that have changed in the last hour, compress them, encrypt them and then copy them to both a local backup machine and an off site backup.
Is there any kind of utility or kernel module that creates some type of log of modified files? I know I can use find, but the search for -mtime in this directory takes quite a while and will not suffice for an hourly backup.
View 3 Replies
View Related
Nov 29, 2010
To find all files recursively starting with a . (period), is the following OK:
find ./ -name '.'*
View 7 Replies
View Related
Apr 19, 2010
i am a newbie in linux ,i am writing a bash script to identify the files which are exactly 7 days ( a week old) i tried this command find /var/backup -mtime +7 -exec ls -d {} ;but this gives me even the files which are older than 7 days
[root@proxy access]# find . -mtime +7 -exec ls -d {} ;
./access.log.1.gz
./access.log.2.gz
[code]...
View 3 Replies
View Related
Apr 23, 2010
I am looking for this `struct messages_sdd_t` and I need to search through a lot of *.c files to find it.However, I can't seen to find a match as I want to exclude all the words 'struct' and 'messages_sdd_t'. As I want to search on this only 'struct messages_sdd_t' The reason for this is, as struct is used many times and I keep getting pages or search results.The directory I am searching in, has another directories so it will have to search recursively.I have been doing this without success:Code: find . -type f -name '*.c' | xargs grep 'struct messages_sdd_t'and thisCode: find . -type f -name '*.c' | xargs egrep -w 'struct|messages_sdd_t'
View 3 Replies
View Related