Sponsored Content
Top Forums Shell Programming and Scripting Search for string in filename, not file content Post 302414133 by jsmoriss on Monday 19th of April 2010 10:02:35 AM
Old 04-19-2010
Quote:
Originally Posted by daflore
How can I search for a string in a filename? For example, I want to know if a filename (not the file contents) contains the string "test".
In what language?

Assuming bourne shell, how about:

Code:
expr index filename len >/dev/null && echo ok

js.

Last edited by zaxxon; 04-19-2010 at 11:11 AM.. Reason: code tags please, ty
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find filename based on file content

:confused: There is a flat file on my system which contains email addreses of people in my company. This file is utilized when sending notifications for various things. However nobody knows where this file is located or what it is named. The only thing we know is the email address of a user who... (4 Replies)
Discussion started by: kollerj
4 Replies

2. Shell Programming and Scripting

Adding filename into file content

Dear Experts, Please help to teach me how to add the filename into the file content. Actually the file name are EVENTS-20050912. ***************New output that I want*************** EVENTS-20050912 03:33:37 ALARM: BTSSPAN-277-1 30-18013 EVENTS-20050912 12:10:28 ALARM: BTSSPAN-297-2... (1 Reply)
Discussion started by: missutoomuch
1 Replies

3. Shell Programming and Scripting

shell script to search a string and delete the content

Hi, I've a shell script e.g. #!/bin/bash echo "Enter the next hop id" read nhid echo "enter the IP address" read IP echo "enter the interface name" read name echo "enter the enable/disable state" read state exit 0 now from this script i want to search strings in another (.cam) ... (6 Replies)
Discussion started by: vic_mnnit
6 Replies

4. Shell Programming and Scripting

How to search (grep?) filename for a string and if it contains this then...

Hi i want to write a script that will search a filename e.g. test06abc.txt for a string and if it contains this string then set a variable equal to something: something like: var1=0 search <filename> for 06 if it contains 06 then var1=1 else var1=0 end if but in unix script :) (4 Replies)
Discussion started by: tuathan
4 Replies

5. Shell Programming and Scripting

How do I search first&second string & copy all content between them to other file?

Hi All, How do I search first string & second string and copy all content between them from one file to another file? Please help me.. Thanks In Advance. Regards, Pankaj (12 Replies)
Discussion started by: pankajp
12 Replies

6. Shell Programming and Scripting

grep exact string from files and write to filename when string present in file

I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Discussion started by: JC_1
4 Replies

7. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

8. UNIX for Dummies Questions & Answers

Find all files containing string not following symlinks CAT (modified) output content to /filename

This should recursively walk through all dirictories and search for a specified string in all present files, if found output manicured content (eg some regex) with CAT into a specified directory (eg /tmp/) one by one, keeping the original names This is what I have so far, which seems to... (1 Reply)
Discussion started by: lowmaster
1 Replies

9. Shell Programming and Scripting

How to prepend filename to its content without a third file?

Hello, Is possibly there a way to prepend the filename to its content without a third file? The reason is to add a header to each file contents to distinguish each other when they are pasted side-by-side. sample.txt: XLOC_001 0 XLOC_002 23 XLOC_003 4 XLOC_012 6output (with the same... (4 Replies)
Discussion started by: yifangt
4 Replies
OPENSSL_PKCS7_VERIFY(3) 						 1						   OPENSSL_PKCS7_VERIFY(3)

openssl_pkcs7_verify - Verifies the signature of an S/MIME signed message

SYNOPSIS
mixed openssl_pkcs7_verify (string $filename, int $flags, [string $outfilename], [array $cainfo], [string $extracerts], [string $con- tent]) DESCRIPTION
openssl_pkcs7_verify(3) reads the S/MIME message contained in the given file and examines the digital signature. PARAMETERS
o $filename - Path to the message. o $flags -$flags can be used to affect how the signature is verified - see PKCS7 constants for more information. o $outfilename - If the $outfilename is specified, it should be a string holding the name of a file into which the certificates of the persons that signed the messages will be stored in PEM format. o $cainfo - If the $cainfo is specified, it should hold information about the trusted CA certificates to use in the verification process - see certificate verification for more information about this parameter. o $extracerts - If the $extracerts is specified, it is the filename of a file containing a bunch of certificates to use as untrusted CAs. o $content - You can specify a filename with $content that will be filled with the verified data, but with the signature information stripped. RETURN VALUES
Returns TRUE if the signature is verified, FALSE if it is not correct (the message has been tampered with, or the signing certificate is invalid), or -1 on error. CHANGELOG
+--------+------------------------------------+ |Version | | | | | | | Description | | | | +--------+------------------------------------+ | 5.1.0 | | | | | | | The $content parameter was added. | | | | +--------+------------------------------------+ NOTES
Note As specified in RFC 2045, lines may not be longer than 76 characters in the $filename parameter. PHP Documentation Group OPENSSL_PKCS7_VERIFY(3)
All times are GMT -4. The time now is 06:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy