Sponsored Content
Top Forums Shell Programming and Scripting How do you check for a particular string in 1000's of files? Post 302705765 by jim mcnamara on Tuesday 25th of September 2012 12:44:59 PM
Old 09-25-2012
try:
This gives you a list of files to work on:
Code:
cd /path/to/many/files
for fname in *
do 
  grep -qF  '{d "%w- %d %m-, %Y - %T"} Model_Type={t}, ModelName={m}' $fname
  if [ $? -ne 0 ] ; then
     echo $fname
  fi
done > /tmp/files.lis

For the next step we need sample input and expected output. We can apply the data in files.lis to do the work.
This User Gave Thanks to jim mcnamara For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check all files in directories for string and remove.. possible?

Say I am in /var/adm/bin and I want to search through all the various scripts and such in that directory for a string, say, xxx@yyy.com I want to find every file with that in there and replace it with a single space. Is that possible? Or, is it possible to search every file and get a list... (7 Replies)
Discussion started by: LordJezo
7 Replies

2. Shell Programming and Scripting

Creating 1000 files using a script

I would like to write a script that would create 1000 files like clm0001.txt to clm1000.txt. All the files would contain the same contents. How do I achieve this using a script?Please help. (2 Replies)
Discussion started by: ggayathri
2 Replies

3. Shell Programming and Scripting

move first 1000 files

Hi i have a folder with 27,000 images. I need to process each image using imagemagick. I have got image magick working. I don't want to attempt to process all 27,000 images in one go and thought i would try doing it with 1000 images at a time. Is there some way i can list only the first 1000... (7 Replies)
Discussion started by: timgolding
7 Replies

4. Shell Programming and Scripting

Script to find the string contain in which file 1000 files.

Hi Greetings i have 1000 files (xmlfiles) and i need to find which file contain the string over 1000 file all file end with txt i tried with grep -c "string" *.txt i am getting an error -bash: /bin/egrep: Argument list too long i have put an script like below #!/bin/bash for line... (9 Replies)
Discussion started by: venikathir
9 Replies

5. Shell Programming and Scripting

Adding a line to 1000's of files right after x amt of characters.

I am trying to add a single line of text to every file in a particular folder. There are thousands of files in the folder. Each file contains this same start of the first line: {d "%w- %d %m-, %Y - %T"} <some message here> with the rest of the text following the second curly bracket... (10 Replies)
Discussion started by: dlundwall
10 Replies

6. Programming

Python: Check 2 text files for string and print contexts

I have 2 text files: cities.txt San Francisco Los Angeles Seattle Dallas master.txt Atlanta is chill and laid-back. I love Los Angeles. Coming to Dallas was the right choice. New York is so busy! San Francisco is fun. Moving to Boston soon! Go to Seattle in the summer. ... (0 Replies)
Discussion started by: pxalpine
0 Replies

7. UNIX for Dummies Questions & Answers

Remove files from tar archive which are more than 1000 days old.

I am not able to extract/remove files older than 1000 days from a tar archive in linux system. #!/usr/bin/perl @file_list = `find /home/x/tmp/ -name *xxMsg* -ctime +7`; $file_name = '/home/x/tmp/new_archive.tar'; for... (1 Reply)
Discussion started by: DannyV
1 Replies

8. UNIX for Dummies Questions & Answers

Best way to parse 1000 scripts for a string?

I have inherited code from a former employee and I need to identify the scripts he disabled with exit 0 at the top. After *many* trials and errors, I finally got this to work alan@p33 => find . -name "*.ksh" -exec sh -c "head -v -n2 '{}' | tail -v -n 1 | grep -H '^exit 0'" \; (standard... (7 Replies)
Discussion started by: alan
7 Replies

9. Shell Programming and Scripting

Creating a sequence of numbers in a line for 1000 files

Hi, I try to explain my problem , I have a file like this: aasdsaffsc23 scdsfsddvf46567 mionome0001.pdb asdsdvcxvds dsfdvcvc2324w What I need to do is to create 1000 files in which myname line listing a sequence of numbers from 0001 to 1000. So I want to have : nomefile0001.txt that must... (10 Replies)
Discussion started by: danyz84
10 Replies

10. Shell Programming and Scripting

How to check in a folder all files which doesnt have the specifc string?

I have a folder with 100s of dat files, with delimiter "|", in some files they didn't provide this delimiter. how to automatically check those list of files in a folder which doesnt have a delimiter or string this way "|" is it possible? Thank you very much for the helpful info. (3 Replies)
Discussion started by: cplusplus1
3 Replies
mcx erdos(1)							  USER COMMANDS 						      mcx erdos(1)

  NAME
      mcx erdos - compute shortest paths in a graph

  SYNOPSIS
      mcx erdos [options]

      mcxerdos	is  not  in  actual  fact  a program. This manual page documents the behaviour and options of the mcx program when invoked in mode
      erdos. The options -h, --apropos, --version, -set, --nop, -progress <num> are accessible in all mcx modes. They are  described  in  the  mcx
      manual page.

      mcx  erdos  [-query  <fname>  (query input stream)] [-abc <fname> (specify label input)] [-imx <fname> (specify matrix input)] [-tab <fname>
      (use tab file)] [-o <fname> (output file name)] [--is-directed (input graph  is  directed)]  [--is-undirected  (input  graph  is	directed)]
      [-write-path  <fname>  (path  matrix file)] [-write-step <fname> (step matrix file)] [-h (print synopsis, exit)] [--apropos (print synopsis,
      exit)] [--version (print version, exit)]

  DESCRIPTION
      mcx erdos computes shortest paths in graphs.  It can read a graph either in label format with -abc or in native format with -imx.  It  reads
      pairs of node indices from an input stream, and for each pair outputs a data structure describing the full set of shortest paths between the
      two nodes.  Edge weights are not taken into account, so an edge always represents a unit step size between two  nodes  irrespective  of  its
      weight. A mode to compute shortest paths while taking into account edge weights will be implemented later as mcx dijkstra.

      Note  that  the  full set of shortest paths between two nodes in a graph can be described as a directed acyclic graph (DAG), and this is how
      mcx erdos operates. It is easy to construct graphs and node pairs for which the number of shortest paths between the two nodes becomes expo-
      nential in the size of the graph, whereas the lattice description is always garantueed to map to a subset of the graph edge set.

      By  default  it is assumed that the input graph should be treated as undirected. To this end a transformation step is applied to ensure that
      the graph in memory is undirected. It is possible to compute shortest paths in directed graphs by using --is-directed, and it is possible to
      omit  the  transformation  step  by using --is-undirected.  If the latter is specified while the input graph is in native format and in fact
      directed, results will be erroneous. This could in theory be mitigated by checking that the input graph is undirected. However,  the  reason
      to  use --is-undirected is simply to increase speed of operation, whereas such a check would be equally expensive as the transformation step
      that is omitted with --is-undirected.

      The input graph/matrix, if specified with the -imx option, has to be in mcl matrix/graph format. You can use label input	instead  by  using
      the  -abc option.  Refer to mcxio(5) for a description of these two input formats.  By default mcx erdos reads from STDIN and expects matrix
      format.  To specify label input from STDIN use -abc -.

  OPTIONS
      -query <fname> (query input)
	The name for the file from which queries are read.  A query consists of two white-space separated node indices or  two	white-space  sepa-
	rated labels. Labels can only be used if either -abc or -tab is specified.

      -abc <fname> (label input)
	The file name for input that is in label format.

      -imx <fname> (input matrix)
	The file name for input that is in mcl native matrix format.

      -o <fname> (output file name)
	The name of the file to write output to.

      -tab <fname> (use tab file)
	This  option causes the output to be printed with the labels found in the tab file.  With -abc this option will, additionally, construct a
	graph only on the labels found in the tab file.  If this option is used in conjunction with -imx the tab domain and the matrix domain  are
	required to be identical.

      --is-directed (compute directed shortest paths)
	The input graph is not transformed and assumed to be directed.	Shortest paths are computed taking this into account.

      --is-undirected (skip symmetrification step)
	The  input  graph  is not transformed and assumed to be undirected.  Shortest paths are computed on the assumption that the input is undi-
	rected. Use this option only if you are sure the input is undirected and need to have faster execution.

      -write-path <fname> (path matrix file)
      -write-step <fname> (step matrix file)
	The path matrix enumerates the nodes that take part in all shortest paths. The first list contains those nodes that lie at distance  1	of
	the  source  node, the second list contains nodes lying at distance 2, and so on.  The step matrix contains all the edges that make up the
	lattice of shortest paths between the two query nodes.

  SEE ALSO
      mcxio(5), and mclfamily(7) for an overview of all the documentation and the utilities in the mcl family.

  mcx erdos 12-068						      8 Mar 2012							mcx erdos(1)
All times are GMT -4. The time now is 11:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy