Sponsored Content
Top Forums Shell Programming and Scripting Check a specific word whether is in file Post 302506453 by anishkumarv on Sunday 20th of March 2011 11:16:14 PM
Old 03-21-2011
Hi dude,


Quote:
#/bin/bash
cat family.txt | grep father
s=`echo $?`
if [ $s = 1 ]
then
echo "the command is correct"
else
echo "the command is not correct"
fi
With Regards
Anish Kumar.v

Last edited by anishkumarv; 03-21-2011 at 04:41 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove a non-specific word froma file

Hi All, I am encountering a problem while removing a string from a file. Actually, i have done this thing before using sed to replace the word but this time word is not specfic. its value is changing with each file. e.g. %HD% Serial Number list per DN required. +3... (2 Replies)
Discussion started by: apjneeraj
2 Replies

2. Shell Programming and Scripting

To search a file for a specific word in a file using shell script

Hi All, I have a sql output file has below. I want to get the values 200000040 and 1055.49 .Can anyone help me to write a shell script to get this. ACCOUNT_NO ------------------------------------------------------------ BILL_NO ... (8 Replies)
Discussion started by: girish.raos
8 Replies

3. UNIX for Dummies Questions & Answers

Search a specific word from any one of the file.

how do i Search a specific word from any one of the file.? (1 Reply)
Discussion started by: ritusubash
1 Replies

4. Programming

C++ > check if a file contains a word...

I wanna check if a file located in /home/user/.config/Home/unkilled.txt contains the word 'permitted'... I am a beginner in C++. This is my code: 1. #include <stdio.h> 2. #include <cerrno> 3. #include <sys/stat.h> 4. #include <fstream> 5. #include <sys/types.h> 6. #include... (1 Reply)
Discussion started by: hakermania
1 Replies

5. UNIX for Dummies Questions & Answers

How to print line starts with specific word and contains specific word using sed?

Hi, I have gone through may posts and dint find exact solution for my requirement. I have file which consists below data and same file have lot of other data. <MAPPING DESCRIPTION ='' ISVALID ='YES' NAME='m_TASK_UPDATE' OBJECTVERSION ='1'> <MAPPING DESCRIPTION ='' ISVALID ='NO'... (11 Replies)
Discussion started by: tmalik79
11 Replies

6. UNIX for Dummies Questions & Answers

How to print the specific word in a file.

Hi , My input file is below like that :- $cat abc.txt Service name: test_taf Service is enabled Server pool: test_tac Cardinality: 2 Disconnect: false Service role: PRIMARY Management policy: AUTOMATIC DTP transaction: false AQ HA notifications: true Failover type: SESSION... (3 Replies)
Discussion started by: sp001
3 Replies

7. UNIX for Dummies Questions & Answers

Word check within file

I am trying to see if a word exists within the file, then do command accordingly. cmd=$(grep -ci "$word" $file) if ; then echo "Word exists" else echo "Word does not exist." fiI try this code, but it keeps giving me syntax errors for the cmd line. Am I doing something... (3 Replies)
Discussion started by: itech4814
3 Replies

8. UNIX for Dummies Questions & Answers

Quick UNIX command to display specific lines in the middle of a file from/to specific word

This could be a really dummy question. I have a log text file. What unix command to extract line from specific string to another specific string. Is it something similar to?: more +/"string" file_name Thanks (4 Replies)
Discussion started by: aku
4 Replies

9. Shell Programming and Scripting

Search for a specific word and print only the word from the input file

Hi, I have a sample file as shown below, I am looking for sed or any command which prints the complete word only from the input file. Ex: $ cat "sample.log" I am searching for a word which is present in this file We can do a pattern search using grep but I need to cut only the word which... (1 Reply)
Discussion started by: mohan_kumarcs
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
ENCHANT_DICT_QUICK_CHECK(3)						 1					       ENCHANT_DICT_QUICK_CHECK(3)

enchant_dict_quick_check - Check the word is correctly spelled and provide suggestions

SYNOPSIS
bool enchant_dict_quick_check (resource $dict, string $word, [array &$suggestions]) DESCRIPTION
If the word is correctly spelled return TRUE, otherwise return FALSE, if suggestions variable is provided, fill it with spelling alterna- tives. PARAMETERS
o $dict - Dictionary resource o $word - The word to check o $suggestions - If the word is not correctly spelled, this variable will contain an array of suggestions. RETURN VALUES
Returns TRUE if the word is correctly spelled or FALSE EXAMPLES
Example #1 A enchant_dict_quick_check(3) example <?php $tag = 'en_US'; $r = enchant_broker_init(); if (enchant_broker_dict_exists($r,$tag)) { $d = enchant_broker_request_dict($r, $tag); enchant_dict_quick_check($d, 'soong', $suggs); print_r($suggs); } ?> The above example will output something similar to: Array ( [0] => song [1] => snog [2] => soon [3] => Sang [4] => Sung [5] => sang [6] => sung [7] => sponge [8] => spongy [9] => snag [10] => snug [11] => sonic [12] => sing [13] => songs [14] => Son [15] => Sonja [16] => Synge [17] => son [18] => Sejong [19] => sarong [20] => sooner [21] => Sony [22] => sown [23] => scone [24] => song's ) SEE ALSO
enchant_dict_check(3), enchant_dict_suggest(3). PHP Documentation Group ENCHANT_DICT_QUICK_CHECK(3)
All times are GMT -4. The time now is 03:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy