Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to find a word in a all the files in a Directory?? Post 302242913 by shikhakaul on Friday 3rd of October 2008 07:37:27 AM
Old 10-03-2008
Error Thank you and one more question

print "count,pub,prodline,group,sector,date,source" > $fname

cat sp_log.summary.$firstday-$lastday.ProdlineSector | sed "s/^ *//g;s/ *$//g" >sp_log.summary.$firstday-$lastday

cat sp_log.summary.$firstday-$lastday | sed "s/$/ $lastyy-$lastmm cache/;s/ /,/g" >> $fname

cat $fname | sed "s/NULL//g" >$fname.new


THIS is the part of a shell script which creates a .CSV file.

Now for the data under pub field, i want to inset a ' in front of the data getting inserted.

Can someone please help??Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

search for certain word in a files from directory

hi can i know how to get the file name of any files containing for example "abc" from a number of files in a directory? i tried "ls -ltrc | grep abc" but no resulted generated. thanks in advance. (1 Reply)
Discussion started by: legato
1 Replies

2. Shell Programming and Scripting

Shell:Find a word in files in a directory and subdirectories

I'm looking to write a ksh code with will be alble to find a word like 'toto' in all files going from my current directory. eg. /doc ----------->have: text.c which "toto" /doc/usr-------->have: build.pc, help.java which "toto" /doc/usr/cach -->have: test.sh which "toto" /doc/build... (4 Replies)
Discussion started by: yeclota
4 Replies

3. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurence of a specific word

Hello, I have several files in a specific directory. A specific string in one file can occur in another files. If this string is in other files. Then all the files in which this string occured should be deleted and only 1 file should remain with the string. Example. file1 ShortName "Blue... (2 Replies)
Discussion started by: premier_de
2 Replies

4. Shell Programming and Scripting

Find and replace a word in all the files (that contain the word) under a directory

Hi Everyone, I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap". For Example: In the Directory, $pwd /home/nick $ grep -l "xsgd1234dap" *.sh | wc -l 119 I have "119" files that are still using... (5 Replies)
Discussion started by: filter
5 Replies

5. Shell Programming and Scripting

How can i find a word inside a file from a directory and it's subdirectory ?

Suppose i have a word "mail". I have to search this word in all files inside a directory and it's sub-directories. It will also search in all hidden directory and sub-directories. If it finds this word in any file it will list that file. How can i do this with perl/ruby/awk/sed/bash or... (9 Replies)
Discussion started by: cola
9 Replies

6. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

7. Shell Programming and Scripting

Find word in a directory files

Hi folks, i have a file in which i have words like below words.txt(file name) and words are arranged likes no spaces between words Apple Banana Carrot And i have list files which have these words in a directory (/tmp/satemp) test1.txt test2.txt test3.txt So if the word 'Apple' is... (3 Replies)
Discussion started by: coolboy98699
3 Replies

8. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurrence of a specific word

he following are the files available in my directory RSK_123_20141113_031500.txt RSK_123_20141113_081500.txt RSK_126_20141113_041500.txt RSK_126_20141113_081800.txt RSK_128_20141113_091600.txt Here, "RSK" is file prefix and 123 is a code name and rest is just timestamp of the file when its... (7 Replies)
Discussion started by: kridhick
7 Replies

9. Shell Programming and Scripting

Find command to find a word from list of files

I need to find a word '% Retail by State' in the folder /usr/sas/reports/RetailSalesTaxallocation. When I tried like below, -bash-4.1$ cd /usr/sas/reports/RetailSalesTaxallocation -bash-4.1$ find ./ -name % Retail by State find: paths must precede expression: Retail Usage: find ... (10 Replies)
Discussion started by: Ram Kumar_BE
10 Replies

10. Shell Programming and Scripting

Find a word and increment the number in the word & save into new files

Hi All, I am looking for a perl/awk/sed command to auto-increment the numbers line in file, P1.tcl: run_build_model sparc_ifu_dec run_drc set_faults -model path_delay -atpg_effectiveness -fault_coverage add_delay_paths P1 set_atpg -abort_limit 1000 run_atpg -ndetects 1000 I would like... (6 Replies)
Discussion started by: jypark22
6 Replies
mcx diameter(1) 						  USER COMMANDS 						   mcx diameter(1)

  NAME
      mcx diameter - compute the diameter of a graph

  SYNOPSIS
      mcx diameter [options]

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

      mcx  diameter  [-abc <fname> (specify label input)] [-imx <fname> (specify matrix input)] [-o <fname> (output file name)] [-tab <fname> (use
      tab file)] [-t <int> (use <int> threads)] [-J <intJ> (a total of <intJ> jobs are used)] [-j <intj> (this job has index  <intj>)]	[--summary
      (output diameter and average shortest path length)] [--list (list eccentricity for all nodes)] [-h (print synopsis, exit)] [--apropos (print
      synopsis, exit)] [--version (print version, exit)]

  DESCRIPTION
      mcx diameter computes the diameter of a graph. The input graph should be symmetric. Results will be unpredictable for directed graphs.   For
      label input this is irrelevant as mcx diameter will create a symmetric graph from the input.

      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 diameter  reads  from  STDIN  and  expects
      matrix format.  To specify label input from STDIN use -abc -.

  OPTIONS
      -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.

      -t <int> (use <int> threads)
      -J <intJ> (a total of <intJ> jobs are used)
      -j <intj> (this job has index <intj>)
	Computing  the diameter of a graph is time-intensive.  If you have multiple CPUs available consider using as many threads. Additionally it
	is possible to spread the computation over multiple jobs/machines.  Conceptually, each job takes a number of threads from the total thread
	pool.  If job control is used (the -J option is used) then the number of jobs should not exceed the number of threads. The total number of
	threads divided by the total number of jobs defines the number of threads that will be used by the current job.  Additionally, the  number
	of threads specified signifies the total added amount of all threads across all machines and must be the same for all jobs. This number is
	used by each job to infer its own set of tasks.  The following set of options, if given to as many commands, defines three jobs, each run-
	ning four threads.

	-t 12 -G 3 -g 0
	-t 12 -G 3 -g 1
	-t 12 -G 3 -g 2

      --list (list eccentricity for all nodes)
      --summary (output diameter and average eccentricity)
	The  default  mode  is --list, which results in output of the eccentricity of all nodes. The eccentricity of a node is the distance to any
	node that is the furthest away from it. The diameter of a graph is the maximum of the eccentricity taken over all nodes in  a  graph.	In
	this mode mcx diameter will not output the diameter itself. Use --summary to output just the diameter and the average eccentricity.

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

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