Simple to you not simple to me pattern matchin help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Simple to you not simple to me pattern matchin help
# 1  
Old 07-22-2007
Question Simple to you not simple to me pattern matchin help

hey all, im new and my first question is:

say i have a word "blahblah"

how do i get and replace the last letter of the word with say k, so replace the h with a k.

However you cant just replace the h it has to change the LAST LETTER of the word.

Cheers In advance.
Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

2. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

3. Shell Programming and Scripting

Simple Pattern Match

Hello ! Experts, I saw a ton of postings here about Awk pattern matching and even after going through all of it, what I have concocted isnt working for me. Here is what I am after. I have a huge set of csv files and in the fifth column, I have text like this --- ANFD10239CS9 BCDD93948CS9... (5 Replies)
Discussion started by: PG3
5 Replies

4. Shell Programming and Scripting

Pattern Matchin Huge File

Hi Experts, I've issue with the huge file. My requirement is I need to search a pattern between the 155-156 position and if its match's to 31 or 36 then need to route that to a new separate files. The main file has around 1459328 line and 2 GB in size. I tired with the below code which take... (9 Replies)
Discussion started by: senthil.ak
9 Replies

5. Shell Programming and Scripting

Awk -simple pattern matching

Find bumblebee and Megatron patterns (input2) in input1. If it is + read input1 patterns from Left to Right if it is - read input1 patterns from Right to Left Y= any letter (A/B/C/D) input1 c1 100 120 TF01_X1 + AABDDAAABDDBCADBDABC c2 100 120 TF02_X2 - AABDDAAABDDBCBACDBBC... (2 Replies)
Discussion started by: bumblebee_2010
2 Replies

6. UNIX for Dummies Questions & Answers

Simple search pattern help

Hi I need to define a pattern that will match an open square bracket, a series of numbers fro 1 to 4 digits in length and a close square bracket. Examples of the numbers I will need to find are: or or or I am using BBEdit to search, and BBEdit uses the standard GREP search... (1 Reply)
Discussion started by: alisamii
1 Replies

7. UNIX for Dummies Questions & Answers

Pattern matchin Between Two Files

Hi All, I have two files as below: file1 file2 AAAA CCCC,1234,0909 BBBBB AAAA,1234 AAAA DDDD,23536,9090 CCCC DDDD EEEEE I want a out file as below AAAA,1234 BBBB AAAA,1234... (5 Replies)
Discussion started by: thana
5 Replies

8. Shell Programming and Scripting

OS differences in simple pattern match

Hi folksSorry if code tags don't work out correctly but this PC does not have Java setup correctly to allow me to put them inproperly.I have a simple string pattern match behaving differntly on AIX and Solaris 10 and I don't understand why or what to do about it.This simple test: -) ]] && echo... (4 Replies)
Discussion started by: steadyonabix
4 Replies

9. Shell Programming and Scripting

Simple egrep pattern

I'm new to egrep. What pattern could I use to find all lines that match this pattern: <beginning of line><any amount of whitespace>sub<space>. I want it to return the entire line. (I'm trying to generate a list of all Perl sub definitions in a list of Perl modules.) Thanks for your help! (7 Replies)
Discussion started by: blondie53403
7 Replies

10. UNIX for Dummies Questions & Answers

Ok simple question for simple knowledge...

Ok what is BSD exactly? I know its a type of open source but what is it exactly? (1 Reply)
Discussion started by: Corrail
1 Replies
Login or Register to Ask a Question
PREG_FILTER(3)								 1							    PREG_FILTER(3)

preg_filter - Perform a regular expression search and replace

SYNOPSIS
mixed preg_filter (mixed $pattern, mixed $replacement, mixed $subject, [int $limit = -1], [int &$count]) DESCRIPTION
preg_filter(3) is identical to preg_replace(3) except it only returns the (possibly transformed) subjects where there was a match. For details about how this function works, read the preg_replace(3) documentation. RETURN VALUES
Returns an array if the $subject parameter is an array, or a string otherwise. If no matches are found or an error occurred, an empty array is returned when $subject is an array or NULL otherwise. EXAMPLES
Example #1 Example comparing preg_filter(3) with preg_replace(3) <?php $subject = array('1', 'a', '2', 'b', '3', 'A', 'B', '4'); $pattern = array('/d/', '/[a-z]/', '/[1a]/'); $replace = array('A:$0', 'B:$0', 'C:$0'); echo "preg_filter returns "; print_r(preg_filter($pattern, $replace, $subject)); echo "preg_replace returns "; print_r(preg_replace($pattern, $replace, $subject)); ?> The above example will output: preg_filter returns Array ( [0] => A:C:1 [1] => B:C:a [2] => A:2 [3] => B:b [4] => A:3 [7] => A:4 ) preg_replace returns Array ( [0] => A:C:1 [1] => B:C:a [2] => A:2 [3] => B:b [4] => A:3 [5] => A [6] => B [7] => A:4 ) SEE ALSO
PCRE Patterns, preg_quote(3), preg_replace(3), preg_replace_callback(3), preg_grep(3), preg_last_error(3). PHP Documentation Group PREG_FILTER(3)