Ubuntu :: Make Multiple Text Files Into .lst Wordlists?
Sep 20, 2010Make multiple text files into .lst wordlists?
View 7 RepliesMake multiple text files into .lst wordlists?
View 7 RepliesCombine multiple text files into one text file?
View 5 Replies View RelatedLong story short, I got a folder with nearly 800,000 php files. I would like to search each file for a string and if it exists in that file, the file gets copied to another directory. Is this possible from the terminal? So far I got: grep -i -n -r 'ppr-1792' * | cp $1 move_to_here
But this obviously doesn't work. $1 needs to be the file name that contains matching text.
I'm pretty sure this is doable from the command line, but my CLI skills have degraded a lot since my pre-Y2K admin days. The goal is to search all the files in the directory for a very long string of text and replace it with another string of text. The text being searched for is my Google Adsense code (which will be stripped from my website) and it will be replaced with a placeholder so I can easily tack something else in there in the future.
Seeing how I have that long snip of code on about 100 pages, automating the process would make life easier.
If I was searching for a single word, I can see ways to do this.
If I paste the code I'm searching for into a text file, is there a way to:
find (contents of oldstring.txt) and replace with (contents of newstring.txt)?
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 RelatedI currently have 3 files with floating point data that I wish to have in a single file with the format:
Code:
F1 F1 F3 Output
a1 b1 c1 a1 b1 c1
a2 b2 c2 a2 b2 c2
a3 b3 c3 a3 b3 c3
a4 b4 c4 a4 b4 c4
I have 2 text files : file1.txt and file2.txt
cat file1.txt
15 this is a sentence containing various words and spaces
34 this is a another sentence containing various words and spaces
cat file2.txt
2 this is sentence1file2
6 this is sentence2file2
54 this is sentence3file2
I would like to join these 2 files. The result should look as follows :
cat joinedfile.txt
2 this is sentence1file2
6 this is sentence2file2
15 this is a sentence containing various words and spaces
34 this is a another sentence containing various words and spaces
54 this is sentence3file2
==> so the joined file must be sorted on the first number. Any ideas how this can be achieved ?
Can I use sed to include a text file in the beginning of other text files inside a folder and its subfolders? So it should be recursive.
View 4 Replies View RelatedI would like to write a text user interface (TUI) to adjust some text config files etc. Is there a tool or application for creating TUIs like this. I�m talking about those types of config tools which you see executed at first boot.
View 19 Replies View Relatedmay be an advanced question but I need to know how to do this. Here at work I am in charge of recruiting and we have about 1,000 resumes in already. All of the resumes are in a .pdf format. I need to rename every .pdf in the following format:{firstnameLastname}.pdfThe only way I know how to do this is to convert all the .pdf files to text, extract the name out of the first few lines of text, import into excel, and then use VBA to rename the files in mass:Here is my logic so far:~Deskop/a = houses all the .pdfresumesOpen terminal: Code: cd ~/Desktop/afor f in *.pdf; do pdftotext -raw $f; done That will convert all of the preceding resumes into text filesNow I would like to append the name of the text file into the last line of the text file. So, for example, for Resume1.txt, I want to append "Resume1.txt" to the last line within Resume1.txt. So after I run the command I open Resume1.txt and on the last line within I want to see "Resume1.txt" on the last line, at the end of the resume.How can I do this? I would like to use a loop and have the terminal append the filename to the body of the text file until all of the have been appended.
View 1 Replies View RelatedCurrently, when I'm searching text in files of my PHP project, I use this line :
Code:
grep -r 'myTextToFind' *
But now, I would like to search only in ".lang" files. How can I do that ?
have a large amount of 7z files in multiple folders which I need to extract.The directory structure is like this:
/main-folder/
multiple subfolders/
1 or more 7z files per subfolder
I would like to get the output of this action in one separate folder, all together in 1 folder.How can I do this?
I often use the rpl command to make changes to multiple html files at once. For example:
rpl -R '<br />' '<br /><br />' mydirectory However, I haven't been able to figure out how to change multiple lines. For example, let's say I want to change all occurrences of :
<br />
<br />
to:
<br />
I've tried
rpl -R '<br />
<br />' '<br />' mydirectory
but that didn't work. how to do this with rpl or some other way?
I am to rename all the files within a directory (which contains multiple subdirectories) recursively without invalid characters.
I tried the coding posted above.
find . -type f -printf '%p
' | while read file; do
oldfile=$(basename "$file")
newfile=$(echo "$oldfile" | sed 's/[^A-Za-z0-9_.]/_/g')
if [ ! "$newfile" == "$oldfile" ]; then
echo mv "$file" "${file%$oldfile}$newfile"
code....
but I get an error on both of them stating "find: bad option -printf find: [-H | -L] path-list predicate-list"
I sometimes have two similar files that one works and one doesn't. I would like to compare the differences. But TEXT EDITOR opens two files in two tabs making it impossible to compare the data side by side.
Is there a way to make Text editor open a separate window for each file? Browsers usually have such an option to choose multiple windows or tabs but I can't find away to do this with Text editor.
I'm using GNOME terminal to SSH into a Debian server and would really like a way to paste multiple lines of text into configuration files (using the nano text editor if possible).
So far whatever I try dumps all the text onto a single line meaning I have to manually go through inserting line feeds which is tedious and can introduce errors.
Is there a way to paste text with line feeds intact? Rather than copying each line individually?
how would i highlight multiple selections in a graphical text editor such as gedit, kwrite, kate, leafpad, etc. is it possible? for example; if i wanted to redact a document by removing several different words throughout the document.
i could probably learn vim or nano and regular expressions without too much trouble if those would work better.
I have a list of words that I want to grep in many files to see which ones have it and which ones dont. in the text file I have all the words listed line by line, ex: list.txt:
check
try this
word1
word2
open space
list ..
I want to grep each line one by one. like I want it to
grep "check" *.log
grep "try this" *.log
grep "word1" *.log .. etc how can I do this?
and maybe write the output to a file.
tell me which text editor supports multiple overlapping windows (eg like turbo C++ 1.01 IDE ? ). Currently I'm using gedit and find that I cannot see two or more files at the same time
View 8 Replies View RelatedI want to edit a text file and have it open twice so I can edit different sections without scrolling back and forth. I can do this in Kwrite and Kate but have to have two windows open. Is there a way to do this but with tabs?
View 11 Replies View RelatedI am an astronomy student using Ubunut 10.04, and a frequent user of IRAF ( an *nix image processing application geared toward astronomy). IRAF produces, amongst other things, a text document with various values on it (example below).
Code: K IRAF = NOAO/IRAFV2.14.1 version %-23s
#K USER = name %-23s
#K HOST = Balthazar computer %-23s
#K DATE = 2010-04-29 yyyy-mm-dd %-23s
[Code]...
Now, the information I'm actually interested is the X and Y coordinates down towards the bottom (in this case, 973.505, 271.474).
I have about 800 of these output text files, and I was wondering if there's any sort of script or command that could go through them (presumably reading from a list of file names), and extract the coordinates. Ideally, the output would be a list of coordinates (i.e. X-coordinate, Y-coordinate).
For example, I have a text file with data which lists numerical values from two separate individuals
Code:
Person A
100
[code]...
I found this command that works great finding and replacing a simple string to another in files located in that folder and all sub-folders.
Code: find . -name '*.php' | xargs perl -pi -e 's/OldText/NewText/g'
The problem I have is that I need to replace a more complex string, like this: Old string: /mnt/stor6-wc2-dfw1/627896/982574/ New string: /mnt/stor8-wc2-dfw1/369587/302589/ There I don't know how to do it... since the / is what separates the old from the new strings, and the strings that I want to replace have / in it. Also, I would like to know how to specify under what folder replace the files, for example, I want that it search/replaces all files under /var/www/mysite/htdocs folder.
I want to automate this using script.How to automate it?
File1:
s.no# 1 name:aaaaaa
city:abcd
[code]...
Fedora provides several compression techniques. E.g tar, tar.gz, zip etc. I want to know which among them provides
1. the best compression ratio for text files
2. the best compression ratio for binary files
3. fastest compression
How do you convert Open Office (ODT) documents to Text files?
I have made a report using libre office. Now I wish to continue editing the document using lyx (latex front end). So the ODT file needs to be saved as some .tex file.
I don't see an option to do this in File menu (export/save as). So is there any other plugin to do this?
Is it possible to remove multiple packages listed in a text file? Similar to "cat orphan.txt | zypper rm" or "zypper rm <orphan.txt." Neither worked.
View 8 Replies View RelatedFor example, I have a text file with data which lists numerical values from two separate individuals
Code:
Person A
100
200
300
400
500
600
700
800
900
1000
1100
1200
Person B
1200
1100
1000
900
800
700
600
500
400
300
200
100
How would I go about reading the values for each Person, then being able to perform mathematical equations for each Person (finding the sum for example)?
I am trying to think of a logic where my file contains some data I had to read and do some processing. Issue is that file contains data multiple times. For example:
:::::::::::
var1=value1
var2=value2
[code].....
I have to read first paragraph of variables and do some processing and then move on until the end of file. Variable names are same in whole file but for each paragraph the value is different. I can't think of a logic to attain this task. How can I do it? It should be a simple bash script, but I am not able to work out.
How can you create a script to move or copy files from a main directory into multiple directories below the main directory.
View 7 Replies View Related