Software :: Scan The Text For Patterns?
Apr 4, 2011
I remember using some dos program that would scan text files for particular words/patterns. It had an ncurses-like interface and if I'm not wrong its name was "Concord". Is there anything like that on linux? The main functionality was as follows:
1. support for regular expressions
2. print lines containing a particular word or pattern (highlighting it) and printing the surrounding lines.
3. print lines containing a particular word or pattern only if another pattern occurs within N words to the left/right.
The second point is easy to achieve in grep. The 3rd one could be done in awk. The problem is that as much fun as it would be to put it all together and embellish with some nice ncurses interface(eg. with dialog), I don't want to reinvent the wheel. Besides, I have just relocated and have been waiting for my phone line welcome pack for almost 2 weeks now (ie. no internet apart from work and mobile phone), which makes it difficult for me to get anything done.
View 2 Replies
ADVERTISEMENT
Nov 22, 2010
I want to replace a pattern with other pattern in a textfile. But there are two same patterns,but I need two change only the second occurence. EG:
Text file is
aaaa=1
bbbb=2
cccc=3
dddd=4
[code]....
Now I want to change aaaa=x into some other entry.
View 3 Replies
View Related
Aug 13, 2010
I am trying to compare a list of patterns from one file and grep them against another file and print out only the unique patterns. Unfortunately these files are so large that they have yet to run to completion. Here's the command that I used:
Code: grep -L -f file_one.txt file_two.txt > output.output Here's some example data:
Code:
>FQ4HLCS01BMR4N
>FQ4HLCS01BZNV6
>FQ4HLCS01B40PB
>FQ4HLCS01BT43K
>FQ4HLCS01CB736
>FQ4HLCS01BU3UM
>FQ4HLCS01BBIFQ
how to increase efficiency or use another command?
View 14 Replies
View Related
Feb 10, 2011
Neither my Simple Scan nor the Xsane image scan facility appears to be able to scan a typed document to editable text. Is there software available to enable this facility on Ubuntu 10.10 using my HP Officejet 6313?
View 7 Replies
View Related
Apr 26, 2010
Fedora12/Kde4After a Sane Scan how do I Save a scan as a *.txt file ? gocr does not work, I can save in any other format but a txt file.
View 6 Replies
View Related
Jul 16, 2010
Something very handy to do in a Linux shell, is manipulating files and strings - essentially parsing data. Write a utility which will scan in a text file and search and replace strings. We also want to keep track of how many strings we've replaced.
I know that my command would look like this: <utility name> <filename> <stringToSearchFor> <stringToReplaceWith>
Code: #!/bin/bash
[code]....
View 2 Replies
View Related
Jan 9, 2011
I installed squeeze on my eeepc 1015ped and downloaded the correct firmware-brcm80211 drivers but every time I scan for my network using iwconfig wlan0 scan or wicd, my computer completely freezes. I previously had a solid install running xmonad, and wicd was working like a charm (using the same broadcom driver) but i tinkered too much with it and decided to do a fresh install. I haven't quite run into a problem like this before.
View 2 Replies
View Related
Jul 29, 2011
Awk varying patterns to different file?
[Code]...
What I want to do is when the records have identical $3 i.e. same gene:blabla, I want to put them in a file with $3.out (P.S. along with the lines below it) I tried grepping out $3 first separately onto a file, and then taking each line in that file as a pattern and pulling out records using awk. Somehow I faced probs with pulling out onto $3.out
View 6 Replies
View Related
Aug 10, 2010
I am interested in using the grep method in the shell of my CentOS machine to obtain patterns from a file and use them to search through another file and highlight the patterns found. For example:
pattern file:
one
two
three
test file:
AAAAAAAAAAAAAAAAAAAAAoneAAAAAAAAAAAAAAAAthreeAAAAAAAAAAAA
View 8 Replies
View Related
Dec 13, 2010
I have to write a script which would search the IP adesseses in a given directory.
Below is my command.
Code:
grep -HwrnI --exclude=*.log '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}' *|grep -v '/.svn/'
I have to exclude the following from search resluts.
1. Comments
a. Can be starting with /, * or #...
b. Cane be between a line
EX: some text... #comment1
View 9 Replies
View Related
Jun 9, 2010
I want to traverse a directory and get a list of files that contain a set of patterns. I assumed I could use grep for this, but I having trouble getting grep to only return files that match ALL patterns. Here's what I've come up with so far:
Code:
grep --recursive --file=searchpatterns.txt --files-with-matches somedirectory/*
However, this gives me a list of files that match ANY of the patterns in the searchpatterns.txt file. I want to match ALL of the patterns. I've looked through the man page, but can't find anything that allows me to change the "OR" to "AND" for multiple patterns.
View 5 Replies
View Related
Apr 7, 2011
i have a problem about deleting a line from a text file which contains two specific patterns. i am using "sed -i "/$name/ d" peop.txt" but i must use one more variable which is surname.
"
burak:ak:3242:2342:dsa@a.com
gokhan:an:432:4234:da@a.com
"
and this is the code of text file. and the second question when i use "/$name/ d" it deletes not only the names which are macthing with $name but also all words that contain $name. so how can i fix these problems_?
View 2 Replies
View Related
Apr 11, 2011
I have a file that goes like this:
I need to grep the lines between pattern 1 and pattern 2 and not the lines following pattern 2. Cannot use grep -A(num), as there are varying number of lines following pattern 1. Also, used awk one-liners, but results are erroneous.
View 14 Replies
View Related
Jun 16, 2010
I have a file that I need to scan and output data between Number and End containing string 123.
Number 1:
6
7
123
1
End
View 1 Replies
View Related
Jul 28, 2010
I am trying to delete any blank lines within two patterns e.g.
Address: 53 HIGH STREET Cred Id :
MYTOWN
MYCOUNTY
MM12 6MM
Pay Method : Crossed Cheque
The start of my pattern is "Cred Id" and the end is "Pay Method" and I want to delete the blank lines between county and post code. I did find the code below but it doesn't seem to change anything:
sed -ne '/Cred Id/,/Pay Method/!bp' -e '/^$/b' -e -e p ll.out
I can get it to print just the range I'm interested in by doing sed -ne '/Cred Id/,/Pay Method/p'.
View 5 Replies
View Related
May 4, 2011
I have a file with joker character patterns:
./include/*
./src/*
etc.
From the current directory I would like to recursively get the list of files that do not match these patterns.
View 2 Replies
View Related
Jul 5, 2011
I'm trying to use sed to search for a certain 'primary' pattern that may exist on several lines, with each primary pattern followed by an --unknown-- number of 'secondary' patterns.The lines containing the pattern start with: test(header_name)On that same line is an arbitrary number of strings that come after it.I want to move those strings over to their own lines so that they each are preceded by their own test(header_name).e.g. Original file (mytest.txt):
apples
test("Type1", "hat", "cat", "dog", "house");
bananas
[code]....
View 2 Replies
View Related
Apr 7, 2011
In Midnight Commander, is it possible to exclude some directories/patterns/... when doing search? (M-?) I'm specifically interested in skipping the .hg subdirectory.
View 1 Replies
View Related
Jan 20, 2009
I'm having a small issue with regex matching in Perl. I'm pretty certain it's a simple fix, but it all looks correct to me...
If I run the following:
Code:
It prints out all the lines containing a 'P', as one would expect. But when the regex is
Code:
I get zero lines printed. It seems to match only single-character patterns.
The file I'm reading is: (It has the same effect whether I leave it with Windows linebreaks or convert them to unix).
Code:
View 3 Replies
View Related
Apr 2, 2011
I put a text file on my desktop and added a couple lines of text with gedit. File type shows text/plain. Double-click opens the file in gedit which is what I want. I'm using the file to temporarily hold some snips of code that I copy from file to file, but when I copy some html into the file and save it, now file properties show it's text/html and a double-click opens the file in firefox, which isn't what I want. Is there some way to keep the file type from changing itself?
View 6 Replies
View Related
Feb 10, 2011
I'm running and XP virtual machine using KVM / QEMU. THere are time when I need to copy text from an application in the Fedora host machine and paste the text into a different app in the XP guest machine. I was able to do this using Vitualbox on an earlier version of Fedora.
View 1 Replies
View Related
May 2, 2010
i am on processing text tasks And i found that if you assign a text to a variable is chomp'ed automatically the newline
Code:
variable=$(cat file.txt)
The problem is i can only access the items/lines using:
Code:
for line in $variable
do
echo $line
# Other commands
done
how do i convert this to an indexed array. More importantly, how do i get access to individual $line[0], ..., $line[n] Another thing, if the file.txt, has lines with spaces it is a mess using the for...in..., but echoing prints line by line...o_0
View 11 Replies
View Related
Jun 1, 2010
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 Related
Mar 21, 2010
I'm looking for a light-weight text editor for general-purpose composition that can preserve indentations on wrapped lines.
View 3 Replies
View Related
May 11, 2010
Is there a simple text editor for Linux that will let you color or highlight text on demand? Something like gedit or leafpad with color? I know I can probably do this with vi or emacs, but I'm looking for something simple, need not be feature rich.
View 4 Replies
View Related
Jan 19, 2009
I need to insert 3-4 lines of text to the beginning of a text file. The file is a largish MYSQL dump, the result of a backup shell script. This shell script should insert the required text.I've wrestled with sed, but lost.
View 2 Replies
View Related
Jan 13, 2010
I have to delete a certain line of text from the a textfile via ubuntu's shell scripting.I have done research, and it seems that most people advocate the usage of sed /d option. sed makes does not edit the text file. Hence, most options I discovered involved the use of a temporary variable/textfile and then overwriting the old file with the temporary new file. Is there anyway whereby I can bypass the use of temporary storage containers? I hope there is any magical combination of commands to edit the file directly.
View 3 Replies
View Related
Jan 8, 2011
I want to display something in my text view widget in glade using c code. that's all right.
now I need to attach a save button beneath the text view.so that on click the text view content should save as a txt file..
View 8 Replies
View Related
Feb 9, 2011
I want to display the contents of a particular log file (simple text file, I mean in Linux). But there is a problem: The contents need to be organized in a fixed format. Have a look at this log file:
sampleLog.txt
Code:
User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!
[code]....
So, while displaying the contents of above file on a web page, I want to format the field names found in the log file: User Name:, Reported Problems Description:, and Remarks:. These fields may contain a variable length of text and no specific line number is assumed for them to appear on.
The desired output should look like this:
User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!
[code]....
Well, what I am trying to do may sound wierd to some of you. The filed "Reported Problems Description:" can possible contain text which embeds colon (.
View 15 Replies
View Related
Nov 5, 2009
I 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 Related