Searching for a list of strings in a file with Python
Hi guys,
I'm trying to search for several strings, which I have in a .txt file line by line, on another file.
So the idea is, take input.txt and search for each line in that file in another file, let's call it rules.txt.
So far, I've been able to do this, to search for individual strings:
How can I change this to input the strings to be searched from another file?
Hi,
I have 5 files in a directory.
emp1_usage.txt
emp2_usage.txt
emp3_usage.txt
emp4_usage.txt
emp5_usage.txt
I am using sqlldr to get the contents of the above 5 files and store it in a temp table and update my original table using temp table.
for f in *emp*.txt
do
sqlldr... (3 Replies)
Hi all,
I have a file entries.txt that contains a number of entries all on seperate lines e.g.
test1
test2
test3
test4
Then in a directory called /TestFiles I have a number of files that could contain the above text in the file name
e.g. qwertytest1.csv qwertytest2.csv... (2 Replies)
Hi all,
I have a file looks something like this:
~~~~~~~~~~~~~~~~~~~~~~~~~
aaaa
bbbbbb
ccc
dddddddd
~~~~~~~~~~~~~~~~~~~~~~~~~
I will like a script that can
echo line1
export line1 as env variable
echo line2
export line2 as env variable
etc
etc
Thanks in advance (3 Replies)
Hello experts,
i am using sun solaris 9
i try to searching string from a file using more command.
I wish when i search a string it will higlight the string/strings from the file.
Have any idea how to do it..?
I use putty.
br//purple (9 Replies)
I have a file 1.txt with the below contents.
-----cat 1.txt-----
1234
5678
1256
1234
1247
-------------------
I have 3 more files in a folder
-----ls -lrt-------
A1.txt
A2.txt
A3.txt
-------------------
The contents of those three files are similar format with different data values... (8 Replies)
Hi Friends,
I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving...
File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
I have few list value which are shown as below and want to print the same to a text file in python.
But I couldn't able to write to a file.
Could anyone please help me how to print the list with tuples to a file .
My code:
======
fout=open('output.txt','w')
mylist =
fout.write()... (1 Reply)
Hello Everyone ,
Iam a newbie to shell programming and iam reaching out if anyone can help in this :-
I have two files
1) Insert.txt
2) partition_list.txt
insert.txt looks like this :-
insert into emp1 partition (partition_name)
(a1,
b2,
c4,
s6,
d8)
select
a1,
b2,
c4, (2 Replies)
Hi Experts,
I am writing a python script to grep string from file and display output in csv file as in attached screenshot
https://drive.google.com/file/d/1gfUUdfmQma33tz65NskThYDhkZUGQO0H/view
Input file(result_EPFT_config_device)
Below is the python script i have prepared as of... (1 Reply)
Discussion started by: as7951
1 Replies
LEARN ABOUT SUSE
ssgrep
SSGREP(1) GNOME SSGREP(1)NAME
ssgrep - search spreadsheets for strings
SYNOPSIS
ssgrep [OPTIONS] [FILES]
DESCRIPTION
This manual page briefly documents the ssgrep command.
ssgrep is a command line utility to search for strings in spreadsheets of any format supported by gnumeric.
OPTIONS
This program follows the usual GNU command line syntax, with single letter options starting with a single dash (`-') and longer options
starting with two dashes (`--').
Options controlling input file handling
--recalc
Recalculate all cells
Options controlling patterns and pattern matching
-f, --keyword-file=FILE
The path to a text file containing one key per line
-i, --ignore-case
Ignore differences in letter case
-w, --word-regexp
Match only whole words
-F, --fixed-strings
Pattern is a set of fixed strings
-R, --search-results
Search results of expressions too
-v, --invert-match
Search for cells that do not match
Options controlling output in general
-c, --count
Only print a count of matches per file
-L, --files-without-matches
Print filenames without matches
-l, --files-with-matches
Print filenames with matches
-q, --quiet
Suppress all normal output
-H, --with-filename
Print the filename for each match
-h, --without-filename
Do not print the filename for each match
-n, --print-locus
Print the location of each match
-T, --print-type
Print the location type of each match
Help options
-V, --version
Display ssgrep's version
-?, --help
Display the supported options
--usage
Display a brief usage message
EXAMPLE
To search for the string "SUM" in the file foo.gnumeric :
ssgrep SUM foo.gnumeric
To search for the strings from the file keywords in the spreadsheet foo.xls :
ssgrep --keyword-file=keywords foo.xls
LICENSE
ssgrep is licensed under the terms of the General Public License (GPL), version 2. For information on this license look at the source code
that came with the software or see the GNU project page <http://www.gnu.org>.
COPYRIGHT
The copyright on ssgrep and the gnumeric software and source code is held by the individual authors as is documented in the source code.
AUTHOR
ssgrep's primary author is Jody Goldberg <jody@gnome.org>; ssgrep builds on the gnumeric codebase.
The initial version of this manpage was based on ssindex.1 by J.H.M. Dassen (Ray) <jdassen@debian.org>.
SEE ALSO beagled(1), gnumeric(1), ssconvert(1), ssindex(1)
The Gnumeric Homepage <http://www.gnome.org/projects/gnumeric/>.
The GNOME project page <http://www.gnome.org/>.
gnumeric 2009-02-08 SSGREP(1)