Sponsored Content
Top Forums Shell Programming and Scripting how to count a word in a file Post 302332820 by unx100 on Friday 10th of July 2009 06:35:58 AM
Old 07-10-2009
HI Gersh99,

Thank you again for the prompt reply and it working fine and working much faster to my code(which I mentioned in the 1st post).
Nawk is something new to me, searched in the beginners unix book (by wrox) nothing much available.

Please correct me if Im worng :
The code is taking 'space' as the space separator.
and if the file is somewhat like this :
Code:
sjhgfjhgdfs ora-0001 kjhsf 098j 97h
suiy23vb jhf8 ora-0001
jkhsdkj 98798 error:ora-0001 uif987

then am getting the output not as ora-0001 : 3 but as
Code:
ora-0001 : 2
error:ora-0001 : 1

is there anyway i can extract only words starting with ora-

Last edited by vgersh99; 07-10-2009 at 07:48 AM.. Reason: code tags, PLEASE!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count the number of occurence of perticular word from file

I want to count the number of occurence of perticular word from one text file. Please tell me "less" command is work in ksh or not. If it is not working then instead of that which command will work. :confused: (40 Replies)
Discussion started by: rinku
40 Replies

2. Shell Programming and Scripting

grep all records in a file and get a word count -perl

Hi, I have a file .. file.txt .. i need to get a total record count in the files into a $variable.. im using perl script thanks (4 Replies)
Discussion started by: meghana
4 Replies

3. Shell Programming and Scripting

How to find a count of a word within a file

Hello, I'm looking for a wait to count the number of occurrences of a certain string of characters within a file. The file that I trying to parce has segments within the file that have a header and footer to each segment and I'm trying to do a count of the header string and compare it to a count... (9 Replies)
Discussion started by: bd_joy
9 Replies

4. UNIX for Dummies Questions & Answers

How to count the occurences of a specific word in a file in bash shell

Hello, I want to count the occurences of a specific word in a .txt file in bash shell. Can somebody help me pleaze?? Thanks!!! (2 Replies)
Discussion started by: mskart
2 Replies

5. UNIX for Dummies Questions & Answers

how to count number of times each word exist in a file

I'm trying to count the number of times each word in the file exist for example if the file has: today I have a lot to write, but I will not go for it. The main thing is that today I am looking for a way to get each word in this file with a word count after it specifying that this word has... (4 Replies)
Discussion started by: shnkool
4 Replies

6. Shell Programming and Scripting

Count characters in a csv file and add an word.

Hello, I want to add a sentence to "post column" those who are only less than 30 characters.Thank you very much for your help. "category","title","post" "Z","Zoo","test 54325 test 45363mc." "Z","Zen","rs2w3rsj 2d342dg 2d3s4f23 d23423s23h 2s34s2423g ds232d34 2342." "Z","Zet","test4444... (3 Replies)
Discussion started by: hoo
3 Replies

7. UNIX for Dummies Questions & Answers

How do I count how many times a specific word appear in a file (ksh)?

Hi Please can you help how do I count the number of specific characters or words that appear in a file? (8 Replies)
Discussion started by: fretagi
8 Replies

8. UNIX for Dummies Questions & Answers

Taking word count from file and printing in file

hi, i am having a file which contains the below content, i need to take the word count of if and print the file name also inputfile.txt file_name1.txt,type_name1.txt file_name2.txt,type_name2.txt i would need the word count of the files like this if file_name*.txt then wc -l... (10 Replies)
Discussion started by: rohit_shinez
10 Replies

9. Shell Programming and Scripting

How to append word count at end of file?

Hi guys, I have to append the word count of a file at the end of the file name like this - > "filename_2345" where 2345 is the word count of "filename". How do i achieve this using one command ? I am not allowed to store the word count in a variable and then concatenate. Request your... (1 Reply)
Discussion started by: peter2312
1 Replies

10. UNIX for Beginners Questions & Answers

UNIX script to check word count of each word in file

I am trying to figure out to find word count of each word from my file sample file hi how are you hi are you ok sample out put hi 1 how 1 are 1 you 1 hi 1 are 1 you 1 ok 1 wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 Replies
General::Interpolated(3pm)				User Contributed Perl Documentation				General::Interpolated(3pm)

NAME
Config::General::Interpolated - Parse variables within Config files SYNOPSIS
use Config::General; $conf = new Config::General( -ConfigFile => 'configfile', -InterPolateVars => 1 ); DESCRIPTION
This is an internal module which makes it possible to interpolate Perl style variables in your config file (i.e. $variable or "${variable}"). Normally you don't call it directly. VARIABLES
Variables can be defined everywhere in the config and can be used afterwards as the value of an option. Variables cannot be used as keys or as part of keys. If you define a variable inside a block or a named block then it is only visible within this block or within blocks which are defined inside this block. Well - let's take a look to an example: # sample config which uses variables basedir = /opt/ora user = t_space sys = unix <table intern> instance = INTERN owner = $user # "t_space" logdir = $basedir/log # "/opt/ora/log" sys = macos <procs> misc1 = ${sys}_${instance} # macos_INTERN misc2 = $user # "t_space" </procs> </table> This will result in the following structure: { 'basedir' => '/opt/ora', 'user' => 't_space' 'sys' => 'unix', 'table' => { 'intern' => { 'sys' => 'macos', 'logdir' => '/opt/ora/log', 'instance' => 'INTERN', 'owner' => 't_space', 'procs' => { 'misc1' => 'macos_INTERN', 'misc2' => 't_space' } } } As you can see, the variable sys has been defined twice. Inside the <procs> block a variable ${sys} has been used, which then were interpolated into the value of sys defined inside the <table> block, not the sys variable one level above. If sys were not defined inside the <table> block then the "global" variable sys would have been used instead with the value of "unix". Variables inside double quotes will be interpolated, but variables inside single quotes will not interpolated. This is the same behavior as you know of Perl itself. In addition you can surround variable names with curly braces to avoid misinterpretation by the parser. SEE ALSO
Config::General AUTHORS
Thomas Linden <tlinden |AT| cpan.org> Autrijus Tang <autrijus@autrijus.org> Wei-Hon Chen <plasmaball@pchome.com.tw> COPYRIGHT
Copyright 2001 by Wei-Hon Chen <plasmaball@pchome.com.tw>. Copyright 2002-2010 by Thomas Linden <tlinden |AT| cpan.org>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> VERSION
2.14 perl v5.10.1 2010-12-01 General::Interpolated(3pm)
All times are GMT -4. The time now is 09:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy