General :: Bash Script To Fgrep A Large File With List As Source For Searching?

Jan 17, 2011

I need to fgrep a list of things which are in a file. The file in which I will do the SEACHING is a large text file and I need fgrep to output each item from the list as a file with the item from the list as the file name.

Its kinda like this:

./script list.txt largefile.txt

output would be

jack.txt
screen.txt
blah.txt

View 14 Replies


ADVERTISEMENT

General :: Searching Text Files For Large Numbers?

Dec 31, 2010

I am looking for a way to search for large numbers in text files and print the nearby lines.

For example if I had a text file like:

Event: 11
blah: 3
blah: 41 bleh: 19
Event: 2
blah: 31

[Code].....

View 1 Replies View Related

Software :: Searching Within A File Using Bash?

Jul 22, 2009

i get the desired result with

find . -name "*" | xargs grep -i "*searchPattern*"

---but not with

find . -name "*" | grep -i "*searchPattern*"

why this difference?

View 6 Replies View Related

Debian Programming :: Searching For A List Of Strings In File With Python

Oct 14, 2013

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:

Code: Select allimport re

shakes = open("output.csv", "r")

for line in shakes:
    if re.match("STRING", line):
        print line,

How can I change this to input the strings to be searched from another file?

So far I haven't been able to.

View 3 Replies View Related

General :: Install One Testing Package By Just Modifying Source.list File?

Apr 26, 2010

I want to pick up Python3 from squeeze, meanwhile I would like to stay with lenny with all other packages. Is this possible by just modifying source.list file?

View 2 Replies View Related

General :: Bash - Shell Utils: Convert A List Of Hex To List Of Decimals?

Dec 27, 2010

How can I convert a file with a lot hex numbers into the decimal?

Example: file1
0x59999
0x5acdc
0xffeff

I want to start $ cat file1 | util | cat >file2 and get file2 with smth like

[Code]...

View 3 Replies View Related

Debian :: Locate And Restore Apt Source List File?

Apr 10, 2009

I seem to have removed / moved / deleted my /etc/apt/source.list file and was wondering where or how can I locate them again on the web? Is there a place online that has the default repository listings for 'Etch' & 'Lenny'? I did not lose them on both but this is something I would like to know in case it ever happens to me. Seems like this would be something easily available on the web but I can't find it on Debian's site and or via Google.

View 7 Replies View Related

Programming :: Passing Arguments To A Bash Source File?

Apr 24, 2010

Is it possible to pass arguments to a source file in a bash script? For example

#!/bin/sh
#
. /dir1/dir1/funclib -a -b

How would you check for the passed arguments in funclib without getting confused with any arguments passed to the main script?

View 5 Replies View Related

General :: Searching Content Of The File Using File Browser Nautilus?

May 27, 2011

I'm using rhel6. Using File Browser Nautilus 2.28.4 I could easily locate any file I'm interested in by it name. I'd like to use this File Browser to locate the file name based on it content e.g. based on some word in the text file. It doesn't work for me that way ... My question: does Nautilus support the search of file based on it content or only based on the name of the file itself?

View 4 Replies View Related

Programming :: Use Zenity In A Bash Script To Display A .csv File Using '--list'?

Jul 22, 2010

I'm trying to use zenity in a bash script to display a .csv file using '--list' to allow the user to edit some of the values.I can display it fine but i'm unsure how to edit the data? all i can get is whichever line is highlited when hitting ok on the zenity dialog to print.the data in the csv is arranged:

<prod>,<disc>,<qty>,<type>,<location>

View 1 Replies View Related

Ubuntu Installation :: E - Type 'usage:' Is Not Known On Line 54 In Source List /etc/apt/sources.list

Jan 23, 2010

Ive seen some fixes for this but they all seem to be specific to the particular user's sources.list . . . ..

Code:

Here is Line 54

Code:

View 2 Replies View Related

Ubuntu Installation :: E: Type Sudo Is Not Known On Line 55 In Source List /etc/apt/sources.list

Mar 12, 2010

I tried to change the basic toolbar to cairo dock,a tutorial that i found told me to write in terminal gksu gedit /etc/apt/sources.list.d/winehq.listso i write it and a window opened,i couled not find the text that told me(the tutorial i mean)so i closed the window,after that i keep taiking the same error

E: Type �sudo� is not known on line 55 in source list /etc/apt/sources.list
E: The list of sources could not be read.
Go to the repository dialogue to correct the problem.
E: _cache->open() failed, please report.

now whene i got in the winehq.list the text has gone and i take this error in update manager,my software center doesn't work and my terminal whenever i type sudo commands says

E: Type �sudo� is not known on line 55 in source list /etc/apt/sources.list

View 9 Replies View Related

Ubuntu :: E - Malformed Line 57 In Source List /etc/apt/sources.list - Dist Parse

Jun 25, 2010

I get this error message: E: Malformed line 57 in source list /etc/apt/sources.list (dist parse)

I am pretty new to Ubuntu and dont really understand computer

Here is the sources list (??) as well

View 3 Replies View Related

Ubuntu :: Error: E: Type 'sudo' Is Not Known On Line 52 In Source List /etc/apt/sources.list

May 4, 2011

don't know much, but when I tried to update I get this error:

E: Type 'sudo' is not known on line 52 in source list /etc/apt/sources.list E: The list of sources could not be read.

View 2 Replies View Related

General :: Searching For Number Within A File?

Nov 9, 2010

I'm currently trying to design a small, simple enough shell program for area codes. I have a list of area codes in a database, and I am trying to write a program that will have a user input an area code, and then have the program print out information that immediately follows that area code in my database. I assume I need to use a find or locate command, but I'm not sure if I should be searching for a string or the number itself. The number could possibly occur at some other point in the file, though the way I have the file set up it only occurs once at the newline.

what function I should use and how I should go about it? As is I only have the absolute bare-bones beginning of having an echo for the prompt to input an area-code, and the read once it's input. Without the find I'm not sure how much farther I can get. Also, would it make it easier if I added some character such as a ! to the end of the number at the newline to make it easier to search for? With a macro that would be easy enough to do.

View 1 Replies View Related

Ubuntu :: Malformed Line 59 In Source List Etc/apt/sources.list?

Sep 1, 2011

There is a problem with my source list (apparently) I'm running 11.04 if that helps.When I try to use apt-get install update for example, I get: "Malformed line 59 in source list etc/apt/sources.list"The same error occurs when trying to access synaptic package manager, it tells me there is a malformed line and the list of sources cannot be read.This error prevents me from apt-getting anything, updating and i suspect it is affecting the software center too.

View 6 Replies View Related

General :: List Of Softwares Installed Using Tar (from Source)?

Dec 11, 2010

If i am installing softwares through rpm, i can later query to see which softwares are installed on my system (using rpm). But if i have installed any softwares from source (using tar, /.configure methodhow can i list those softwares to see which one are installed ?

View 11 Replies View Related

General :: View A Particular Ten Lines In A Large File Where Can't Open The File In Vi

May 12, 2010

I am using RHEL 5.I have a very large test file which cannot be opened in vi.The content of the file has some 8000 lines.I need to view ten lines between 5680 to 5690.How can i view these particular lines in a large file.what is command and option i need to use.

View 1 Replies View Related

Programming :: Bash Function For Searching Files ?

Jun 15, 2011

I'm making a small script for searching and doing some operations with photos, but I'm kinda stuck on this little function:

Code:

function findallformat {
prefix=""
if [ $1 = -pre ] then

[code]....

That function should find for every file with a certain type; and you can specify a prefix using a "-pre" followed by the prefix that you want to search. The format should be "stackable", so you can use as many types that you want, without repeating the same function on the code.

Example: findallformat -pre IMG_ .JPG .CR2 #That should search files that start with "IMG_" and finishes with .JPG and .CR2. My problem it's that, when I try to use it on the script, it says "bash: syntax error near `token' unexpected `}'"

View 4 Replies View Related

General :: Getting Segmention Fault Error While Searching String In Csv File?

Jan 18, 2011

I am using grep command to search in a particular file whose size is 11 GB and i am getting Segmentation fault error as an output. My command and output is as follows:

Code:

[sdpuser@gnnsdp40 test]$ cat new* | grep 8858406465
Segmentation fault

My linux version is as follows:

Code:

[sdpuser@gnnsdp40 test]$ uname -a Linux gnnsdp40 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

how i can parse the complete file for searching string. I have also used split command of linux which splits the file of 11 GB to 11 files of 1 GB each respectively. But still getting the same "Segmentation fault" error while using grep.

View 9 Replies View Related

General :: Aptitude Source List - Error In Authenticating Some Packages

Apr 10, 2011

I do have a problem on updating linux ubuntu 10 I'll show you the error and my sources.list.. Error in authenticating some packages: It was not possible to authenticate some packages. This may be a transient network problem. You may want to try again later. See below for a list of unauthenticated packages.

acpi-fakekey
acpi-support
acpi-support-base
acpid

[code]....

View 4 Replies View Related

General :: Update Debian Squeeze From Lenny's Source.list?

Mar 21, 2011

What happens if I update Debian Squeeze from Lenny's source.list?A step by step manual is written on Lenny, and if I change lenny to squeeze things seem to not work.When I update the squeeze from the original source.list and then change to the source.list that manual uses things are working.But if I were to start squeeze with lenny's source.list I am getting error while trying to do this:

apt-get install wget mc zip unzip bzip2 ntp ntpdate lsb-release.

View 6 Replies View Related

Programming :: Bash - Searching Strings For Array Elements?

Apr 30, 2010

...and returning the index of the found element in its array.

I have:

for ((i=0; i < ${#array1[@]}; i++)); do
# Read each line of the file test
if [[ $(eval "sed -n '$(($i+1))'p test") == *${array2[0]}* ]]
stuff

I want to find the index of the found substring in array2 and only if it isn't found, move on to the next element of array2. I don't know the size of array2 so that [0] has just got to go.

View 14 Replies View Related

General :: Get Elements From List In Bash?

Mar 19, 2010

Here is a LIST:

List = "abcd 1234 jvm something"

How to get the second element "1234" without looping all the list?

View 2 Replies View Related

General :: How To List User Using Bash

Aug 2, 2011

how to list existing users using bash

View 8 Replies View Related

General :: How To List Folders Using Bash Commands

Sep 14, 2011

Is there any way to list just the folders in a directory using bash commands? ( as the ls command lists all the files and folders )

View 3 Replies View Related

General :: Find The Bash Source Files Of Programs In Mac OSX?

Jan 6, 2011

I am currently writing some convenience methods for my terminal in my bash_profile and am sure if what I am writing is "the best way". I figure a good way to verify whether what I'm doing is right or not would be to find some source code of more established programs and see how they do it.My question then is, where can I find this code on my Mac? An example is, with Macports installed, where is the source code that opens the port interactive console when I type nothing but "port" in my shell?(I added Linux in the title even though I am on a Mac because I assume the answer would be the same for both)

View 3 Replies View Related

Programming :: Bash : Searching For Info And Changing The Color Of Keywords In The Results?

May 5, 2011

(bare with me as I am sort of new with scripting) I am trying to figure out how to run a script that does a basic chkconfig and to get only those services that are running, but changing the color of "on" to red in my output file. Here is what I am working with so far:

Quote:

#/bin/bash
RED=$(tput setaf 1)
BLK=$(tput setaf 0)

[code]....

*I had to substitute a "-" and <colon_symbol> for ":" in front of the on's, because the forum thought they were smiley faces (i.e. n) how to make the "on" to be red while the rest of everything remains in black text. I have been trying to read up on sed and awk, but it is still pretty much a mystery to me right now. There will be other things in the output file that I wouldn't want a rogue "on" to be in red, so just the instances of "on" in that one chkconfig return.

View 4 Replies View Related

General :: How To Get List Of Files Not Matching Patterns In Bash

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

General :: Bash Command To List Users Logged In At 5pm

Jun 7, 2010

I need to figure out a bash command to list all users logged in at or after 5pm - 5pm being the specifier in the command.

Code:

Command seems to be the easiest way to display users but it specifies all users log times.

I've also fiddled with the lastlog command to no avail.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved