Sponsored Content
Top Forums Shell Programming and Scripting to read two files, search for patterns and store the output in third file Post 302513750 by vaibhavkorde on Thursday 14th of April 2011 03:18:16 AM
Old 04-14-2011
to read two files, search for patterns and store the output in third file

hello
i have two files
temp.txt
and temp_unique.text

the second file consists the unique fields from the temp.txt file

the strings stored are in the following form

Code:
4,4
17,12
15,65
4,4
14,41
15,65
65,89
1254,1298

i'm able to run the following script to get the total count of a particular string in the file with the command

Code:
grep -cw '4,4'  temp.txt

But the problem is that i want to execute this on temp.txt for each value in temp_unique.txt and store the output in a third file in the form of
String \t count

How can i deal with this ? Smilie

thanks in advance Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

store output to a file and read from it

Hello all, I need to run snoop command for a period of time (a day) and extract remote host column from it to find out who is accessing my server. When I run the following on the command line it works snoop -port 22 | awk '{print $3}' but when I do snoop -port 22 | awk '{print $3}' | while... (2 Replies)
Discussion started by: afadaghi
2 Replies

2. UNIX Desktop Questions & Answers

how to search files efficiently using patterns

hi friens, :) if i need to find files with extension .c++,.C++,.cpp,.Cpp,.CPp,.cPP,.CpP,.cpP,.c,.C wat is the pattern for finding them :confused: (2 Replies)
Discussion started by: arunsubbhian
2 Replies

3. UNIX for Dummies Questions & Answers

trouble using read to store values in variables from command output

I know there are caveats about using read in pipelines because read is treated by a subshell. I know this but I can't think of any way to accomplish this regardless, I'm still a rookie. I hope somebody will be able to interpret what it is that I'm trying to accomplish and correct me. ... (2 Replies)
Discussion started by: ProGrammar
2 Replies

4. UNIX for Advanced & Expert Users

Best way to search for patterns in huge text files

I have the following situation: a text file with 50000 string patterns: abc2344536 gvk6575556 klo6575556 .... and 3 text files each with more than 1 million lines: ... 000000 abc2344536 46575 0000 000000 abc2344536 46575 4444 000000 abc2344555 46575 1234 ... I... (8 Replies)
Discussion started by: andy2000
8 Replies

5. UNIX for Dummies Questions & Answers

script to search patterns inside list of files

>testfile while read x do if then echo $x >> testfile else fi if then echo $x >> testfile else fi done < list_of_files is there any efficient way to search abc.dml and xyz.dml ? (2 Replies)
Discussion started by: dr46014
2 Replies

6. SuSE

Search all files based on first and in all listed files search the second patterns

Hello Linux Masters, I am not a linux expert therefore i need help from linux gurus. Well i have a requirement where i need to search all files based on first patterns and after seraching all files then serach second pattern in all files which i have extracted based on first pattern.... (1 Reply)
Discussion started by: Black-Linux
1 Replies

7. Shell Programming and Scripting

Search for patterns in thousands of files

Hi All, I want to search for a certain string in thousands of files and these files are distributed over different directories created daily. For that I created a small script in bash but while running it I am getting the below error: /ms.sh: xrealloc: subst.c:5173: cannot allocate... (17 Replies)
Discussion started by: danish0909
17 Replies

8. Shell Programming and Scripting

Read line of files and call store procedures

Hi, I wish to write a piece of code to read lines of the flat file and cut each lines of record to a variable, then use this variable to pass as an parameter of a Sybase stored procedures, if there are 5 lines of record from the text file, then this stored procedures will be called 5 times.... (8 Replies)
Discussion started by: newbie2011
8 Replies

9. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies

10. Shell Programming and Scripting

Bash - Find files excluding file patterns and subfolder patterns

Hello. For a given folder, I want to select any files find $PATH1 -f \( -name "*" but omit any files like pattern name ! -iname "*.jpg" ! -iname "*.xsession*" ..... \) and also omit any subfolder like pattern name -type d \( -name "/etc/gconf/gconf.*" -o -name "*cache*" -o -name "*Cache*" -o... (2 Replies)
Discussion started by: jcdole
2 Replies
gtkdoc-mktmpl(1)					      General Commands Manual						  gtkdoc-mktmpl(1)

NAME
gtkdoc-mktmpl -- GTK DocBook documentation generator. SYNOPSIS
gtkdoc-mktmpl [ See below ] DESCRIPTION
gtkdoc-mktmpl This creates or updates the template files which contain the manually-edited documentation. (A template is a simple text form which is filled in with the description of a function, macro, enum, or struct. For functions and macros it also contains fields for describing the parameters.) This script reads in the existing templates, found in tmpl/*.sgml, moves these files to tmpl/*.sgml.bak, and then recreates the .sgml files according to the structure given in the file MODULE-sections.txt. Any new templates added, or new function parameters, are marked with FIXME so you can do a grep to see which parts need updating. Any templates which are no longer used (i.e. they are remove from MODULE-sections.txt) are placed in the file tmpl/MODULE-unused.txt. If they are included again later they are automatically copied back into position. If you are certain that these templates will never be used again you can delete them from MODULE-unused.txt. Any parameters to functions which are no longer used are separated from the rest of the parameters with the line <!-- # Unused Parameters # -->. It may be that the parameter name has just been changed, in which case you can copy the description to the parameter with the new name. You can delete the unused parameter descriptions when no longer needed. EXAMPLE
See /usr/share/doc/gtk-doc-tools/examples, for a makefile.am and a configure.in example file. AUTHOR
This manual page was written by Christian Marillat marillat@debian.org for the Debian GNU/Linux system (but may be used by others). gtkdoc-mktmpl(1)
All times are GMT -4. The time now is 09:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy