Sponsored Content
Top Forums Shell Programming and Scripting Alternative command to grep -w option Post 302959157 by Corona688 on Thursday 29th of October 2015 12:09:54 PM
Old 10-29-2015
Something like this perhaps:

Code:
$ echo "ABC123" | awk '$0 ~ "(^|[ \r\n\t])"P"($|[ \r\n\t])"' P="ABC"
$ echo "123ABC123" | awk '$0 ~ "(^|[ \r\n\t])"P"($|[ \r\n\t])"' P="ABC"
$ echo "ABC 123" | awk '$0 ~ "(^|[ \r\n\t])"P"($|[ \r\n\t])"' P="ABC"
ABC 123

$ echo "123 ABC 123" | awk '$0 ~ "(^|[ \r\n\t])"P"($|[ \r\n\t])"' P="ABC"
123 ABC 123

$ echo "ABC 123" | awk '$0 ~ "(^|[ \r\n\t])"P"($|[ \r\n\t])"' P="ABC"
ABC 123

$

This User Gave Thanks to Corona688 For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grep alternative to handle large numbers of files

I am looking for a file with 'MCR0000000716214' in it. I tried the following command: grep MCR0000000716214 * The problem is that the folder I am searching in has over 87000 files and I am getting the following: bash: /bin/grep: Arg list too long Is there any command I can use that can... (6 Replies)
Discussion started by: runnerpaul
6 Replies

2. Shell Programming and Scripting

--alternative option in getopt

Hi, i need to use --alternative option of getopt for ex . getopt -o a:c: --alternative pw: -- "$@" if i use like this, i am not getting any output.Please help me how to correct this.i need to have a combination of long and short options.But long options have to begin with - and not... (0 Replies)
Discussion started by: padmisri
0 Replies

3. Shell Programming and Scripting

Alternative to grep

How to find a particular line in a file without using grep? (3 Replies)
Discussion started by: proactiveaditya
3 Replies

4. Shell Programming and Scripting

Need best grep option or alternative

Hello, I am processing a text file which contains only words with few combination of characters (it is a dictionary file). example: havana have haven haven't havilland havoc Is there a way to exclude only 1 to 8 character long words which not include space or special characters : '-`~.. so... (5 Replies)
Discussion started by: alekkz
5 Replies

5. Shell Programming and Scripting

-n option with grep command

Hi, what is the meaning of -n option before the grep command ? grep command searches for the specified string in the file tmp_crontab.txt but what does -n mean ? With Regards (1 Reply)
Discussion started by: milink
1 Replies

6. UNIX for Dummies Questions & Answers

alternative to the grep trick

Hi, We used to use the below commands often. ps -ef|grep bc ps -ef|grep abc|grep -v grep Both fairly returns the same result. For example, the process name is dynamic and we are having the process name in a variable, how we can apply the above trick. For example "a" is the... (11 Replies)
Discussion started by: pandeesh
11 Replies

7. Shell Programming and Scripting

Please suggest alternative to grep

Hi Experts, PFB my requirement: I have a file (named file1) containing numbers like: 372846078543002 372846078543003 372846078543004 372846078543005 372846078543006 I have another file (nemed file2)where lines containing these numbers(present in file1) are present; Eg: lppza087; <PERFB >... (6 Replies)
Discussion started by: niladri29
6 Replies

8. Shell Programming and Scripting

Maxdepth command not working in AIX.Need alternative solution for this command

Hi All, I am trying to select 30 days older files under current directory ,but not from subdirectory using below command. find <Dir> -type f -mtime + 30 This command selecting all the files from current directory and also from sub directory . I read some documention through internet ,... (1 Reply)
Discussion started by: kommineni
1 Replies

9. Shell Programming and Scripting

Help with grep, or alternative

say I have a big list of something like: sdg2000 weghre10 fewg53 gwg99 jwegwejjwej43 afg10293 I want to remove the numbers of any line that has letters + 1 to 4 numbers output: sdg weghre fewg gwg jwegwejjwej afg10293 (7 Replies)
Discussion started by: Siwon
7 Replies
KAS_STRINGTOKEY(8)					       AFS Command Reference						KAS_STRINGTOKEY(8)

NAME
kas_stringtokey - Converts a character string into an octal key SYNOPSIS
kas stringtokey -string <password string> [-cell <cell name>] [-help] kas str -s <password string> [-c <cell name>] [-h] DESCRIPTION
The kas stringtokey command converts the character string specified with the -string argument into an octal string suitable for use as an encryption key. The kas command interpreter generates the octal key by using an encryption algorithm on the combination of the specified string and the name of the local cell (as recorded in the local /etc/openafs/ThisCell file). Use the -cell argument to convert a string into a key appropriate for a cell other than the local one. CAUTIONS
This command writes the key to the standard output stream, on which it can possibly be intercepted by third parties. It is not very secure to use the key in an actual Authentication Database entry. OPTIONS
-string <password string> Specifies the character string to convert into an octal key. -cell <cell name> Specifies the complete Internet domain name of the cell to combine with the password string while generating the key. If this argument is omitted, the kas command interpreter determines the name of the local cell by consulting: o First, the value of the environment variable AFSCELL. o Second, the cellname in the /etc/openafs/ThisCell file on the local machine. -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The output is of the following form: Converting I<password string> in realm 'I<cell_name>' yields key='I<key>'. EXAMPLES
The following example shows the octal key equivalent of the string "new_pswd" in the ABC Corporation cell. % kas stringtokey new_pswd Converting new_pswd in realm 'ABC.COM' yields key='346307364320263233342354'. PRIVILEGE REQUIRED
None, and no password is required. SEE ALSO
ThisCell(5), kas(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 KAS_STRINGTOKEY(8)
All times are GMT -4. The time now is 01:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy