Saving file edited whith sed


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Saving file edited whith sed
# 8  
Old 06-26-2010
Quote:
Originally Posted by jim mcnamara
pseudocoder - doesn't alternation usually require '(pattern1|pattern2)' - the surrounding parentheses?
Obviously no Smilie
# 9  
Old 06-26-2010
Quote:
Originally Posted by Scrutinizer
Hi Eagl€, you probably mean:
Code:
egrep '>|^[AGC]*$' infile

But I do not think that works here, since then you filtering on the fact that there happens to be no T present on the lines with 3 characters, otherwise it would match lines with more than 3 of those characters as well.
Right, then T should be added but this time other lines can be matched too.

Code:
egrep '^>|^[A-Z]{3}$' infile

is generic Smilie
# 10  
Old 06-27-2010
@EAGLE,
It is generic, but with any regex pattern you have to wonder what minimum precision is required. In this case [A-Z] is ample precision IMO.

---------- Post updated at 11:18 ---------- Previous update was at 02:57 ----------

Quote:
Originally Posted by pseudocoder
Obviously no Smilie
Smilie There is no need for that..

Quote:
Originally Posted by jim mcnamara
pseudocoder - doesn't alternation usually require '(pattern1|pattern2)' - the surrounding parentheses? I've never tried it that way....
Hi Jim, with egrep you can leave out the outer parentheses if all the patterns are part of the alternation.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed command is saving output as blank file

Hi, I am working on a script where I am adding adding colors to few of the info in the output. Now , after that is done , I see colour codes in log files which I don't want to see.:mad::mad::mad::mad: So , I tried using sed command in script as below which gives me o/p (new.log) as blank file... (7 Replies)
Discussion started by: Dream4649
7 Replies

2. Shell Programming and Scripting

sed - Print Edited Line Along With Original Line

Hi, I have an input file like this line1 line2 line3 hello unix how are you This is what I am expecting my output to be line1 line2 #line3 hello unix how are you line3 hello (3 Replies)
Discussion started by: jacobs.smith
3 Replies

3. UNIX and Linux Applications

Notepad++ hang when open file edited in other text editor

Hi, I would like to ask about the notepad++ text editor application, Although there are alternative and more great text editor in linux (gedit, geany, jedit) im still using the notepad++ sometimes cause for some of my own reason one of those is the minimalist text(what i mean is notepad++ has a... (2 Replies)
Discussion started by: jao_madn
2 Replies

4. Shell Programming and Scripting

issue while copying file dynamically whith in loop?

I need to copy the log file dynamically and that should run in loop , which means it should pick what ever the latest file is updated in that directory. I am able to display the list and copy to directly but i have no idea on how to pick the dynamically updated files. when i use this code, i... (1 Reply)
Discussion started by: johninweb
1 Replies

5. Shell Programming and Scripting

How to read a file name that was recently edited when listed using ls command?

I was trying to write a script that will process recently creatd file. From below, the script should process input_20111230.dat file. sam:/top/work/data/input: ls -ltr input_*.dat -rw-rw-rw- 1 work edprod 455668 Dec 24 09:16 input_20111224.dat -rw-r--r-- 1 work edprod ... (7 Replies)
Discussion started by: siteregsam
7 Replies

6. UNIX for Advanced & Expert Users

Who edited my text file?

I was editing my text file in gvim & I was getting message that its changed & to load again. I work in a workplace environment with everyone having there username.. How can I know that who edited my file? (4 Replies)
Discussion started by: krishanu
4 Replies

7. Solaris

/etc/profile file edited. No command working

I have X4500 and I created a user. I wanted to give him root privileges and for editing the sudoers files I typed visudo sudoers. But it said visudo command not found. After googling I found that we need to set path in etc/profile. I edited that and put the following command ... (3 Replies)
Discussion started by: bharu_sri
3 Replies

8. UNIX for Dummies Questions & Answers

Saving changes when using the sed command

Hi Guys, Working on a script in the Vi editor that requires the fifth column of a particular line changed. e.g. Name:Address:email:A where "A" needs to be changed to what the variable $access holds ($access currently has the words admin access in it) when I use this command : `sed... (3 Replies)
Discussion started by: rc1138
3 Replies

9. UNIX for Dummies Questions & Answers

Edited Path in Profile File

Definitely a unix dummy. I edited the paths in the /etc/profile file - following the instructions on an install package. Now can't use vi, cat pg ls or any other unix commands. Guess I'm in big trouble. Path reads MANPATH=/opt/hpnp/man PATH=/opt/hpnpl/bin LD_LIBRARY_PATH=/opt/hpnp/lib ... (4 Replies)
Discussion started by: thewetch
4 Replies
Login or Register to Ask a Question