Sponsored Content
Full Discussion: finding exact characters
Top Forums UNIX for Dummies Questions & Answers finding exact characters Post 18101 by jrdnoland1 on Saturday 23rd of March 2002 08:21:26 PM
Old 03-23-2002
Question finding exact characters

I want to grep from a file an exact character match.
I tried grep -c "$a $b" $file
where a=6 and b=2
the problem is that I get: 6 2 and 6 20
I just need a count of the occurrence.
I'm using the Bourne shell.
I've also tried grep -c '$a $b' $file;
not sure how to do this - any suggestions?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Listing full file names with the exact length of 3 characters

This is what I have to do: Display the full file name (including the full path) and file size of all files whose name (excluding the path) is exactly 3 characters long. This is the code I have: find / -printf "Name: %f Path: %h Size: %s (bytes)\n" 2>/dev/null | grep -E "Name: .{3,} Path" |... (7 Replies)
Discussion started by: Joesgrrrl
7 Replies

2. Shell Programming and Scripting

finding characters with new line

I have a file sample.txt with the below contents: Aaa - providioning add || dev - reeec dev kapl || ball - HERO || bal - provisioning pro || for given name i need the output to be the contents between - and || (excluding both) for eg : input - Aaa output -... (10 Replies)
Discussion started by: kinny
10 Replies

3. Shell Programming and Scripting

Finding exact match string

Hi All, I'm writing unix script, it should find exact matching in search string. Looks simple but when i started i'm stuck to find the exact match character string. The unix script reads the records from DB Table. The table will have values something likes these Feed : A Feed File name :... (3 Replies)
Discussion started by: luckybalaji
3 Replies

4. Shell Programming and Scripting

Finding the line with the exact same number

Hello All, What i am doing is , i tail a file from certain chatacter and then cat -n to get the line numbers.I search for a particular string and gets it line number. What i am interested in is the next line immediately after the pattern i search. But grep gives me result for all line... (5 Replies)
Discussion started by: kailash19
5 Replies

5. Red Hat

finding exact version of Red Hat Linux

Hi, I would like to know how to find out exact version of linux on the basis of kernel level, uname -a 2.6.18-238.1.1.el5 from above command how to find out exact version of redhat linux? it is showing that version of redhat is 5.0 but it comes under which update like 1,2,3,4,5,6 ... (1 Reply)
Discussion started by: manoj.solaris
1 Replies

6. Shell Programming and Scripting

how to finding the exact pattern

I have a output like below: A1 B2 C1 D3 A12 B4 A14 I am trying to find A1 by using grep grep -i "A1" But I got (4 Replies)
Discussion started by: anupdas
4 Replies

7. Shell Programming and Scripting

finding number in exact column

Dear all, I want to find a number in exact column but I don't know how to do it. Here is the thing, data is shown below, and I want to find 416 in the first column and print it out, how should I deal with it? Thank you very much! ab33 50S01S 958 279.068999 67.251013 -150.172544 67.250000... (5 Replies)
Discussion started by: handsonzhao
5 Replies

8. UNIX for Dummies Questions & Answers

[Solved] Listing files starting with p or f and with the exact length of 3 characters

Hello, I need some help. How can I list files starting with p or f and with the exact length of 3 characters? (2 Replies)
Discussion started by: airbebe
2 Replies

9. Shell Programming and Scripting

Finding first 6 characters

Hi , I'm using KSH88 I tried the following example to get the last 6 characters from a string echo 'abcdefghids' | sed 's/.*\(.\{6\}\)$/\1/' What chages i need to do to get the first 6 characters from the string my desired output should be abcdef Thank you (6 Replies)
Discussion started by: smile689
6 Replies

10. Shell Programming and Scripting

Grep exact match without period or other special characters

If I have a file like the following abc.1 abc abc_1 abc..1 abc*1 abc@1 abc def ghr def...... ddef 5466 def ed def** 123445 I`m trying to find exact words from the list abc def (4 Replies)
Discussion started by: ritakadm
4 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 08:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy