Sponsored Content
Full Discussion: regular expressions memory
Top Forums UNIX for Advanced & Expert Users regular expressions memory Post 302337855 by edidataguy on Saturday 25th of July 2009 08:18:50 PM
Old 07-25-2009
There is a typo error in your code.
It should be:
Code:
sed -e 's/\(.*\)/\1end/' file_name

Actually the below will work:
Code:
sed -e 's/.*/& end/' file_name

 

10 More Discussions You Might Find Interesting

1. Programming

regular expressions in c++

How do I use the regular expressions in c++? (2 Replies)
Discussion started by: szzz
2 Replies

2. Shell Programming and Scripting

Regular Expressions

How can i create a regular expression which can detect a new line charcter followed by a special character say * and replace these both by a string of zero length? Eg: Input File san.txt hello hi ... (6 Replies)
Discussion started by: sandeep_hi
6 Replies

3. Shell Programming and Scripting

regular expressions

Hi, can anyone advise me how to shorten this: if || ; then I tried but it dosent seem to work, whats the correct way. Cheers (4 Replies)
Discussion started by: jack1981
4 Replies

4. UNIX for Dummies Questions & Answers

regular expressions

how to find for a file whose name has all characters in uppercase after 'project'? I tried this: find . -name 'project**.pdf' ./projectABC.pdf ./projectABC123.pdf I want only ./projectABC.pdf What is the regular expression that correponds to "all characters are capital"? thanks (8 Replies)
Discussion started by: melanie_pfefer
8 Replies

5. UNIX for Advanced & Expert Users

regular expressions

I have a flat file with the following drug names Nutropin AQ 20mg PEN Cart 2ml Norditropin Cart 15mg/1.5ml I have to extract digits that are before mg i.e 20 and 15 ; how to do this using regular expressions Thanks ram (1 Reply)
Discussion started by: ramky79
1 Replies

6. UNIX for Dummies Questions & Answers

Regular expressions

In regular expressions with grep(or egrep), ^ works if we want something in starting of line..but what if we write ^^^ or ^ for pattern matching??..Hope u all r familiar with regular expressions for pattern matching.. (1 Reply)
Discussion started by: aadi_uni
1 Replies

7. Shell Programming and Scripting

Regular Expressions

#!/usr/bin/perl $word = "one last challenge"; if ( $word =~ /^(\w+).*\s(\w+)$/ ) { print "$1"; print "\n"; print "$2"; } The output shows that "$1" is with result one and "$2" is with result challenge. I am confused about how this pattern match expression works step by step. I... (8 Replies)
Discussion started by: DavidHe
8 Replies

8. Shell Programming and Scripting

Regular Expressions

what elements does " /^/ " match? I did the test which indicates that it matches single lowercase character like 'a','b' etc. and '1','2' etc. But I really confused with that. Because, "/^abc/" matches strings like "abcedf" or "abcddddee". So, what does caret ^ really mean? Any response... (2 Replies)
Discussion started by: DavidHe
2 Replies

9. Shell Programming and Scripting

Help with regular expressions

I have a file that I'm trying to find all the cases of phone number extensions and deleting them. So input file looks like: abc x93825 def 13234 x52673 hello output looks like: abc def 13234 hello Basically delete lines that have 5 numbers following "x". I tried: x\(4) but it... (7 Replies)
Discussion started by: pxalpine
7 Replies

10. Shell Programming and Scripting

Regular expressions

I need to pick a part of string lets stay started with specific character and end with specific character to replace using sed command the line is like this:my audio book 71-skhdfon1dufgjhgf8.wav' I want to move the characters beginning with - end before. I have different files with random... (2 Replies)
Discussion started by: XP_2600
2 Replies
shevek::regexp(3)					     Library Functions Manual						 shevek::regexp(3)

NAME
shevek::regexp - Use regular expressions. SYNOPSIS
#include <regexp.hh> Public Member Functions regexp (std::string const &pattern=std::string(), bool case_sensitive=false) Create a new object, and optionally fill it with a pattern. regexp & operator= (std::string const &pattern) Set a pattern, removing the previous one. regexp (regexp const &that) Copy a regexp. regexp & operator= (regexp const &that) Copy a regexp. void case_sensitive (bool value=true) Set whether the evaluation should be case sensitive. ~regexp () Destructor, this cleans up internal structures. bool operator() (std::string const &data) Check whether the pattern matches a string, and fill internal match structures if it does. std::string operator[] (unsigned idx) const Retrieve the value of a subexpression from the last matched string. bool valid (unsigned idx) const Test whether a subexpression was filled by the last matching string. unsigned size () const Get the number of subexpression. std::string transform (std::string const &data) const Transform a string with -codes according to the last matching string. std::string const & pattern () const Get the current pattern. Detailed Description Use regular expressions. Member Function Documentation std::string shevek::regexp::operator[] (unsignedidx) const Retrieve the value of a subexpression from the last matched string. This throws an exception if the subexpression is not valid. Author Generated automatically by Doxygen for libshevek from the source code. libshevek Fri May 11 2012 shevek::regexp(3)
All times are GMT -4. The time now is 05:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy