Sponsored Content
Top Forums UNIX for Dummies Questions & Answers [Solved] Listing files starting with p or f and with the exact length of 3 characters Post 302764999 by airbebe on Friday 1st of February 2013 09:05:34 AM
Old 02-01-2013
Yep. Just like that... Smilie

I was trying with find, grep ... and a lot of other combinations.

Thanks!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

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? (3 Replies)
Discussion started by: jrdnoland1
3 Replies

2. UNIX for Dummies Questions & Answers

Recursive directory listing without listing files

Does any one know how to get a recursive directory listing in long format (showing owner, group, permission etc) without listing the files contained in the directories. The following command also shows the files but I only want to see the directories. ls -lrtR * (4 Replies)
Discussion started by: psingh
4 Replies

3. UNIX for Dummies Questions & Answers

Listing all the files names not starting as

hello all, iam new to shell scripting.I have searched the forum and could'nd find a close enough answer and hence this post: I want to list all the file names whose names don't start as abc. For example if my folder constains files with names: abc123.txt,erdf23.rdf,ed45r.fmb i want a... (13 Replies)
Discussion started by: valluvan
13 Replies

4. 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

5. Shell Programming and Scripting

[SOLVED] String length in kornshell

In the kornshell you can get the length of a string with $ x=abc $ print ${#x} 3 If the current locale is a multibyte locale, like de_AT.UTF-8, you get the length of the string in bytes, not characters: $ x=für $ print ${#x} 4 Is there an easy way to get the length of a... (8 Replies)
Discussion started by: hergp
8 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Problem with listing my files

Hello, In my directory i have got a list of files like below unix1a.csv unix1b.csv unix1c.csv unix1d.csv unix1y.csv I have done ls -lrt unix1.csv, how can i get my unix1y.csv also get listed along with this.. (5 Replies)
Discussion started by: sathyaonnuix
5 Replies

7. UNIX for Dummies Questions & Answers

[Solved] How to remove listing of current user cmd from ps -ef listing?

Hi All, Could you please help to resolve my following issues: Problem Description: Suppose my user name is "MI90". i.e. $USER = MI90 when i run below command, i get all the processes running on the system containing name MQ. ps -ef | grep MQ But sometimes it lists... (8 Replies)
Discussion started by: KDMishra
8 Replies

8. Shell Programming and Scripting

Lines starting with special characters

Hi I have a file and need to extract lines starting with "grep ^" I tried with quotes single/double before/after but no luck. suggestion pls, thanks! (2 Replies)
Discussion started by: magnus29
2 Replies

9. UNIX for Dummies Questions & Answers

[Solved] Length of each string

Hi I have a file which has sequences which look like this >String1 aqwertrtrytytyuuijhgddfghhhghhgjhjhhsswekrkmygppdslxmvbnhkwqalldrtjbllnlnlnnnvc >String2 qwwerrtyuiopasdfghjmnbvfklzxerbvcwghjjkoowwqerrtggbddqsdfgaqwcxzakjtyugfsdefrtgyhujiknbbbbcdcdcxsxsx zxzxcvcfcdcg >String3... (5 Replies)
Discussion started by: sa@@
5 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
STRSPN(3)								 1								 STRSPN(3)

strspn - Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask.

SYNOPSIS
int strspn (string $subject, string $mask, [int $start], [int $length]) DESCRIPTION
Finds the length of the initial segment of $subject that contains only characters from $mask. If $start and $length are omitted, then all of $subject will be examined. If they are included, then the effect will be the same as call- ing strspn(substr($subject, $start, $length), $mask) (see "substr" for more information). The line of code: <?php $var = strspn("42 is the answer to the 128th question.", "1234567890"); ?> 2 to $var, because the string "42" is the initial segment of $subject that consists only of characters contained within "1234567890". PARAMETERS
o $subject - The string to examine. o $mask - The list of allowable characters. o $start - The position in $subject to start searching. If $start is given and is non-negative, then strspn(3) will begin examining $sub- ject at the $start'th position. For instance, in the string ' abcdef', the character at position 0 is ' a', the character at posi- tion 2 is ' c', and so forth. If $start is given and is negative, then strspn(3) will begin examining $subject at the $start'th position from the end of $subject. o $length - The length of the segment from $subject to examine. If $length is given and is non-negative, then $subject will be examined for $length characters after the starting position. If $length is given and is negative, then $subject will be examined from the starting position up to $length characters from the end of $subject. RETURN VALUES
Returns the length of the initial segment of $subject which consists entirely of characters in $mask. EXAMPLES
Example #1 strspn(3) example <?php // subject does not start with any characters from mask var_dump(strspn("foo", "o")); // examine two characters from subject starting at offset 1 var_dump(strspn("foo", "o", 1, 2)); // examine one character from subject starting at offset 1 var_dump(strspn("foo", "o", 1, 1)); ?> The above example will output: int(0) int(2) int(1) NOTES
Note This function is binary-safe. SEE ALSO
strcspn(3). PHP Documentation Group STRSPN(3)
All times are GMT -4. The time now is 11:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy