How to search and count strings?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to search and count strings?
# 8  
Old 10-17-2013
try also:
Code:
awk '{$0=tolower($0); print gsub(string,string)}' string="dog" infile

This User Gave Thanks to rdrtx1 For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count the occurences of strings

I have some text files in a folder f1 with 10 columns. The first five columns of a file are shown below. aab abb 263-455 263 455 aab abb 263-455 263 455 aab abb 263-455 263 455 bbb abb 26-455 26 455 bbb abb 26-455 26 455 bbb aka 264-266 264 266 bga bga 230-232 230 ... (10 Replies)
Discussion started by: gomez
10 Replies

2. Shell Programming and Scripting

Count the number of strings

I have 500 text files in a folder. The data of the text files are shown below. USA Germany 23-12 USA Germany 23-12 USA Germany 23-12 France Germany 15-12 France Germany 15-12 France Italy 25-50 China China 30-32 China China 30-32 I would... (1 Reply)
Discussion started by: sahith
1 Replies

3. Shell Programming and Scripting

Search between two search strings and print the value

Based on the forums i have tried with grep command but i am unable to get the required output. search this value /*------ If that is found then search for temp_vul and print and also search until /*------- and print new_vul Input file contains: ... (5 Replies)
Discussion started by: onesuri
5 Replies

4. Shell Programming and Scripting

How to count the number of strings?

Hi, I have a text file as shown below. I would like to count the unique number of connections of each person in the first and second column. Third column is the ID numbers of first column persons and fourth column is the ID numbers of second column persons. susan ali 156 294... (7 Replies)
Discussion started by: mohamad
7 Replies

5. Shell Programming and Scripting

How do I count strings on each line?

Hi Im a very inexperienced bioinformatician I have a large DNA file with about 10000 lines of sequence and need to count the occurrence of TA for each line for example in the file TACGCGCGATA TATATATA GGCGCGTATA I would like to get an output like: 2 4 2 I have tried... (3 Replies)
Discussion started by: Manchesterpaul
3 Replies

6. Shell Programming and Scripting

Count no of occurrence of the strings based on column value

Can anyone help me to count number of occurrence of the strings based on column value. Say i have 300 files with 1000 record length from which i need to count the number of occurrence string which is existing from 213 to 219. Some may be unique and some may be repeated. (8 Replies)
Discussion started by: zooby
8 Replies

7. UNIX for Dummies Questions & Answers

Count the number of strings in a block

Hi, I have the following text in a file: ISA*00* *00* *ZZ*ENS_EDI *ZZ*GATE0215 *110106*2244*U*00401*006224402*1*P*>~ GS*HP*ENS_EDI*GATE0215*20110106*2244*6224402*X*004010X091A1~ ST*835*00006~... (2 Replies)
Discussion started by: donisback
2 Replies

8. Shell Programming and Scripting

count identical strings print last row and count

I have a sorted file like: Apple 3 Apple 5 Apple 8 Banana 2 Banana 3 Grape 31 Orange 7 Orange 13 I'd like to search $1 and if $1 is not the same as $1 in the previous row print that row and print the number of times $1 was found. so the output would look like: Apple 8 3 Banana... (2 Replies)
Discussion started by: dcfargo
2 Replies

9. Shell Programming and Scripting

How to count unique strings

How do I count the total number of unique strings from a file using Perl? Any help is appreciated.. (6 Replies)
Discussion started by: my_Perl
6 Replies

10. Shell Programming and Scripting

Count strings on single line?

I use grep -c often, but cannot for the life of me count the number of occurences of a string on the same line (or within a file): $ cat myfile hello457903485897hello 34329048hellojsdfkljlaskdjgh182390 $ grep -c 2 $ How do I count the number of occurences of "hello" in myfile (i.e. 3)?... (6 Replies)
Discussion started by: cs03dmj
6 Replies
Login or Register to Ask a Question
wstring(3C)						   Standard C Library Functions 					       wstring(3C)

NAME
wstring, wscasecmp, wsncasecmp, wsdup, wscol - Process Code string operations SYNOPSIS
#include <widec.h> int wscasecmp(const wchar_t *s1, const wchar_t *s2); int wsncasecmp(const wchar_t *s1, const wchar_t *s2, int n); wchar_t *wsdup(const wchar_t *s); int wscol(const wchar_t *s); DESCRIPTION
These functions operate on Process Code strings terminated by wchar_t null characters. During appending or copying, these routines do not check for an overflow condition of the receiving string. In the following, s, s1, and s2 point to Process Code strings terminated by a wchar_t null. wscasecmp(), wsncasecmp() The wscasecmp() function compares its arguments, ignoring case, and returns an integer greater than, equal to, or less than 0, depending upon whether s1 is lexicographically greater than, equal to, or less than s2. It makes the same comparison but compares at most n Process Code characters. The four Extended Unix Code (EUC) codesets are ordered from lowest to highest as 0, 2, 3, 1 when characters from different codesets are compared. wsdup() The wsdup() function returns a pointer to a new Process Code string, which is a duplicate of the string pointed to by s. The space for the new string is obtained using malloc(3C). If the new string cannot be created, a null pointer is returned. wscol() The wscol() function returns the screen display width (in columns) of the Process Code string s. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
malloc(3C), string(3C), wcstring(3C), attributes(5) SunOS 5.10 29 Dec 1996 wstring(3C)