Sponsored Content
Top Forums Shell Programming and Scripting Perl RegExp to remove last character from strings Post 302181389 by ospreyeagle on Wednesday 2nd of April 2008 10:44:26 PM
Old 04-02-2008
Perl RegExp to remove last character from strings

I use SAS (a statistical software) and have to remove last character or the last 1/2 numbers that appear after characters from the string using Perl Regular Expression (which is recognized by SAS).

Input: f183ii10 f183ii2 f182ii1 f182ii2 f183iim f22ii f22ii11 f22ii12 pmh4 pmhm

Desired Output:f183ii f183ii f182ii1 f182ii2 f183ii f22ii f22ii f22ii pmh pmh


Thanks for your assistance,

OsE
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

tcl: regexp matching special character

Hello Experts, Can someone help me here: I have a variable which contains a string with "". set var1 {a} set str1 {a is the element i want to match} Now "regexp $var1 $str1" does not work? ("regexp {a\} $str1" works, but var1 gets it's value automatically from another script) Is... (6 Replies)
Discussion started by: sumitgarg
6 Replies

2. Shell Programming and Scripting

Remove parenthesis character (Perl)

Hello, i'm unable to remove the parenthesis character. With $parsed_AsciiName =~ s/\(//; the string is the same And with $parsed_AsciiName =~ s/(//; i retrieve "Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE" Any ideas, please? thank you in advanced. (4 Replies)
Discussion started by: aristegui
4 Replies

3. Shell Programming and Scripting

Perl use split and remove specific character

i want to split the input by a space and remove specific characters like full stop, comma...... etc. and then save each word in an array. i got something below, but it didn't work. can anyone please help me? Thank you #!/usr/bin/perl -w while (<>) { $line = <>; @word = split(' ',... (6 Replies)
Discussion started by: mingming88
6 Replies

4. Shell Programming and Scripting

rename - change n'th character of regexp

Hi, I wonder if its possible to do the following task using rename (perl v5.8.8). I want to find filenames matching the specific pattern and then change chosen character of this pattern to a given character, e.g. do the following renaming: regexp: 'ab' -----> 'a0b' What's the simplest... (0 Replies)
Discussion started by: pms
0 Replies

5. UNIX for Dummies Questions & Answers

Doubt with regexp-meta character

Hi, I am learning reg exp a bit :) Meta char info: {n,m} Matches the preceding character at least n times but not more than m times, for example, 'ba{2,3}b' will find 'baab' and 'baaab' but NOT 'bab' or 'baaaab'. Values are enclosed in braces (curly brackets). Input file: 112 11112... (2 Replies)
Discussion started by: dragon.1431
2 Replies

6. Shell Programming and Scripting

any savant ? using AWK/SED to remove newline character between two strings : conditional removal

I'd like to remove (do a pattern or precise replacement - this I can handle in SED using Regex ) ---AFTER THE 1ST Occurrence ( i.e. on the 2nd occurrence - from the 2nd to fourth occurance ) of a specific string : type 1 -- After the 1st occurrence of 1 string1 till the 1st occurrence of... (4 Replies)
Discussion started by: sieger007
4 Replies

7. Shell Programming and Scripting

perl cmd to remove the control-Z character at end of 10GB file

In a 10-50GB file , at end of file there is Control-z character tried the below options, 1. perl -p -i -e 's/^Z//g' new.txt 2. perl -0777lwi -032e0 new.txt and Sed command, dos2unix etc it takes more time to remove the control-z. need a command or perl program to GO TO LAST LINE OF FILE ... (7 Replies)
Discussion started by: prsam
7 Replies

8. Shell Programming and Scripting

Regexp for string that might contain a given character

I'm probably just not thinking of the correct term to search for :-) But I want to match a pattern that might be 'ABC' or '1ABC' there might be three characters, or there might be four, but if there are four, the first has to be 1 (1 Reply)
Discussion started by: jnojr
1 Replies

9. Shell Programming and Scripting

Filter non-alpha character with grep/regexp

Hi all, I am trying to filter out those lines that contain a "non-alpha" character. An example of my input is the following: zygnematales grb zygocactus grb zygocactus_truncatus plt zygodactyl_foot prt zygoma prt zygomatic prt zygomatic_arch prt zygomatic_bone ... (2 Replies)
Discussion started by: owwow14
2 Replies

10. Shell Programming and Scripting

How to remove certain character strings with awk?

Hi all, I need to remove DBPATH= and /db from the string below using awk (or sed, as it also exists on the machine). Input: DBPATH=/some/path/database/db Desired output: /some/path/database Thank you! (8 Replies)
Discussion started by: ejianu
8 Replies
MFI(4)							   BSD Kernel Interfaces Manual 						    MFI(4)

NAME
mfi -- LSI Logic & Dell MegaRAID SAS RAID controller SYNOPSIS
mfi* at pci? dev ? function ? DESCRIPTION
The mfi driver provides support for the MegaRAID SAS family of RAID controllers, including: - Dell PERC 5/e, PERC 5/i, PERC 6/e, PERC 6/i - Intel RAID Controller SRCSAS18E, SRCSAS144E - LSI Logic MegaRAID SAS 8208ELP, MegaRAID SAS 8208XLP, MegaRAID SAS 8300XLP, MegaRAID SAS 8308ELP, MegaRAID SAS 8344ELP, MegaRAID SAS 8408E, MegaRAID SAS 8480E, MegaRAID SAS 8708ELP, MegaRAID SAS 8888ELP, MegaRAID SAS 8880EM2, MegaRAID SAS 9260-8i - IBM ServeRAID M1015, ServeRAID M5014 These controllers support RAID 0, RAID 1, RAID 5, RAID 6, RAID 10, RAID 50 and RAID 60 using either SAS or SATA II drives. Although the controllers are actual RAID controllers, the driver makes them look just like SCSI controllers. All RAID configuration is done through the controllers' BIOSes. mfi supports monitoring of the logical disks in the controller through the bioctl(8) and envstat(8) commands. EVENTS
The mfi driver is able to send events to powerd(8) if a logical drive in the controller is not online. The state-changed event will be sent to the /etc/powerd/scripts/sensor_drive script when such condition happens. SEE ALSO
intro(4), pci(4), scsi(4), sd(4), bioctl(8), envstat(8), powerd(8) HISTORY
The mfi driver first appeared in NetBSD 4.0. BSD
March 22, 2012 BSD
All times are GMT -4. The time now is 04:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy