Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Check if string contains substring surrounded by numbers Post 303038015 by rdrtx1 on Wednesday 21st of August 2019 11:08:39 AM
Old 08-21-2019
Code:
[[:digit:]]E[[:digit:]]


Last edited by rdrtx1; 02-18-2020 at 08:03 PM..
These 2 Users Gave Thanks to rdrtx1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

can i get a substring from a string?

for example, the string a is "abcdefg", can i get a substring "bcd" (from ato a) from string a? thank you (4 Replies)
Discussion started by: dell9
4 Replies

2. Shell Programming and Scripting

getting a substring from a string

hi all, I am trying to extract SUBSTRINGS out of a string using ksh. The string is "SAPR3K.FD0.FA.TJ.B0010.T050302" I tried using a= `expr substr $stringZ 1 2` which is giving me a syntax error, donno why?? any ideas why its not working?? I also tried echo "welcome" | awk '{... (3 Replies)
Discussion started by: maradona
3 Replies

3. UNIX for Dummies Questions & Answers

How to get the substring from the string

Hi All, Can anybody help me to get the substring from the given string. (3 Replies)
Discussion started by: Anshu
3 Replies

4. Shell Programming and Scripting

get substring from string

Hi All, Problem Description: XML_REP_REQUEST=`CONCSUB "$LOGIN" "SQLAP" "$RESP_NAME" "$USRNM" WAIT="Y" "CONCURRENT" "APPLICATION_SHORT_NAME" "CP_SHORT_NAME"` echo Report Request: $XML_REP_REQUEST --to print value in log file While execution the value of 'XML_REP_REQUEST' is 'Prozess... (5 Replies)
Discussion started by: suman.g
5 Replies

5. Shell Programming and Scripting

Help with string and substring also I/O

#!/bin/sh PRINTF=/usr/bin/printf PASSWD=/etc/passwd $PRINTF "Enter a UserID\n" read USERID if ; then $PRINTF "$USERID does not exist, please contact IT service\n" exit 1 fi USERHOME=`grep "^$USERID:" $PASSWD | awk -F : '{print $6}'` USERSHELL=`grep "^$USERID:"... (1 Reply)
Discussion started by: ikeQ
1 Replies

6. Programming

Check for a substring

Hi, I have a macro which I use with ROOT. In this macro I want to check if a part of string exist so I can ignore it inside a loop. So, inside a loop I want to have something like: if (string == "pre_ti_data_bdt*" || string == "pre_ti_data_nn*") continue;but of course I cannot use * in this... (11 Replies)
Discussion started by: faizlo
11 Replies

7. Programming

check substring

hi everyone I have a C program where I have a line and I want to check if the line contains a string.The line is stored in a buffer.How can I do that? Can I consider the whole line as a string and check for a substring?And if so what's the most efficient way to achieve it? (1 Reply)
Discussion started by: vlm
1 Replies

8. Shell Programming and Scripting

Substring check in IF condition in shell script

I want to check if the string has the substring in IF condition then process... i tried below but not working if ]; then ............. field can be "reserved1" ....reservedn / fillspaces1 ... fillspacesn (4 Replies)
Discussion started by: greenworld123
4 Replies

9. Shell Programming and Scripting

Check if a string starts with certain values and ends with numbers

This is very basic. Yet Iam struggling to get the right pattern for my check. Apologize in advance to ask a very lame question. I have to validate if a value of the variable starts with "efgh" and followed by 6 numbers. Var1="efgh234567" The condition Iam trying to achieve is similar to... (6 Replies)
Discussion started by: deepakwins
6 Replies

10. Shell Programming and Scripting

Extracting substring within string between 2 token within the string

Hello. First best wishes for everybody. here is the input file ("$INPUT1") contents : BASH_FUNC_message_begin_script%%=() { local -a L_ARRAY; BASH_FUNC_message_debug%%=() { local -a L_ARRAY; BASH_FUNC_message_end_script%%=() { local -a L_ARRAY; BASH_FUNC_message_error%%=() { local... (3 Replies)
Discussion started by: jcdole
3 Replies
STRSTR(3)						     Linux Programmer's Manual							 STRSTR(3)

NAME
strstr - locate a substring SYNOPSIS
#include <string.h> char *strstr(const char *haystack, const char *needle); DESCRIPTION
The strstr() function finds the first occurrence of the substring needle in the string haystack. The terminating `' characters are not compared. RETURN VALUE
The strstr() function returns a pointer to the beginning of the substring, or NULL if the substring is not found. BUGS
Early versions of Linux libc (like 4.5.26) would not allow an empty argument. Later versions (like 4.6.27) work correctly, and return haystack when needle is empty. CONFORMING TO
ISO 9899 SEE ALSO
index(3), memchr(3), rindex(3), strchr(3), strpbrk(3), strsep(3), strspn(3), strtok(3) GNU
1993-04-12 STRSTR(3)
All times are GMT -4. The time now is 07:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy