Why does this SED example work?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Why does this SED example work?
# 8  
Old 07-06-2012
Yes, .* would greedily match all characters. This is not particular to sed but to almost all regex engines including grep, perl, awk...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem getting sed to work with variables

Hello, I am processing text files looking for a string and replacing the first occurrence of the string with something else. For the text,id Name 1 methyl-(2-methylpropoxy)-oxoammonium 2 N-amino-N-(methylamino)-2-nitrosoethanamine 3 3-methoxy-3-methyloxazolidin-3-ium... (12 Replies)
Discussion started by: LMHmedchem
12 Replies

2. UNIX for Dummies Questions & Answers

sed command does not work as expected

Why when I use this command do I get "E123"? echo NCE123 | sed -n 's/\(.*\)\(\{1,\}\{1,5\}\)\(.*\)/\2/p' But when I used this command, I get NCE123? echo NCE123 | sed -n 's/\(.*\)\(\{3\}\{1,5\}\)\(.*\)/\2/p' I thought \{1,\} would mean any number of characters and \{1,5\ would mean 1-5... (1 Reply)
Discussion started by: newbie2010
1 Replies

3. Shell Programming and Scripting

sed to work on 2nd field only

I have a requirement to replace "\" with "/" in only the 2nd field of the input file which has 2 fields. The field delimiter is "|" Sample records from input file: 1\23|\tmp\user mn\wer|\home\temp Expected output: 1\23|/tmp/user mn\wer|/home/temp I used sed 's/\\/\//g' ... (2 Replies)
Discussion started by: krishmaths
2 Replies

4. UNIX for Dummies Questions & Answers

sed won't work

Hi All, can anybody tell me what's wrong with this code? # SEARCH replaced by REPLACE #!/bin/bash SEARCH="95$$ 0 t" REPLACE="95$$ 1 t" for I in `ls *000.inp | cut -c-12`; do echo $I sed 's/$SEARCH/$REPLACE/' ${I}-000.inp > ${I}-100.inp done It don't replace the string... (5 Replies)
Discussion started by: f_o_555
5 Replies

5. Shell Programming and Scripting

Alternate work out for sed command

Iam trying to insert a line after #Cluster in the property file shown below #Node=Nodehostname:NodeProfilename Node=testNode:test_profile #Cluster=Cluster_Name:nodeName@ClusterMem1,nodeName@ClusterMem2,.... #DC=DCname:DCnodegrp:DCtemp DC=test_DC:test_NG:test_template i was using sed command... (12 Replies)
Discussion started by: SSSB
12 Replies

6. Shell Programming and Scripting

Sed with sort doesnt work

Sed with sort doesnt work The below code doesnt work: sed -e '/^$/d' -e 's/,/|/g' | sort -t"|" -k1,1 -u file1 when i seperate them it work but i have to create intermediate file which i dont want to: sed -e '/^$/d' -e 's/,/|/g' file1 > file2 sort -t"|" -k1,1 -u file2 Help... (2 Replies)
Discussion started by: pinnacle
2 Replies

7. Shell Programming and Scripting

Use variable in sed don't work.

Hi all. I have a script as below: cutmth=`TZ=CST+2160 date +%b` export cutmth echo $cutmth >> date.log sed -n "/$cutmth/$p" alert_sbdev1.log > alert_summ.log My purpose is to run through the alert_sbdev1.log and find the 1st occurence of 'Jan' and send everything after that line to... (4 Replies)
Discussion started by: ahSher
4 Replies

8. Shell Programming and Scripting

Getting sed to work on part of a line

I been trying to get this right. I have trying to get rid of spaces in between the character < and the character >. Everytime I try, sed gets too greedy and do the whole line. Ex. < T AG 1> Hello, how are you doing? <Tag 2> I am doing fine. I want this: <TAG1> Hello, how are you... (6 Replies)
Discussion started by: quixoticking11
6 Replies

9. Shell Programming and Scripting

sed script. How does it work?

I'm using this command sed -e "s/'/'/g" -e 's/&quot;/"/g' -e 's/&amp;/\&/g' myfile.txt My question is does this command reads file 3 times applying different replacement each time or it reads it only once and do 3 replacements at the same time? My concern is, since I have big files (1 MB or more) that... (2 Replies)
Discussion started by: billy5
2 Replies

10. Shell Programming and Scripting

sed doesn't work

Hello I' m confused a bit. I want to replace string "&amp" with "&" using this command. sed 's/&amp/&/g' and it doesn't work. Nothing happens. On the other side this works: sed 's/&amp/@/g' or sed 's/&amp/^/g' !!! Can somebody help please? Thanks (3 Replies)
Discussion started by: billy5
3 Replies
Login or Register to Ask a Question
XmScrollVisible(library call)											     XmScrollVisible(library call)

NAME
XmScrollVisible -- A ScrolledWindow function that makes an invisible descendant of a ScrolledWindow work area visible SYNOPSIS
#include <Xm/ScrolledW.h> void XmScrollVisible( Widget scrollw_widget, Widget widget, Dimension left_right_margin, Dimension top_bottom_margin); DESCRIPTION
XmScrollVisible makes an obscured or partially obscured widget or gadget descendant of a ScrolledWindow work area visible. The function re- positions the work area and sets the specified margins between the widget and the nearest viewport boundary. The widget's location relative to the viewport determines whether one or both of the margins must be adjusted. This function requires that the XmNscrollingPolicy of the ScrolledWindow widget be set to XmAUTOMATIC. scrollw_widget Specifies the ID of the ScrolledWindow widget whose work area window contains an obscured descendant. widget Specifies the ID of the widget to be made visible. left_right_margin Specifies the margin to establish between the left or right edge of the widget and the associated edge of the viewport. This margin is established only if the widget must be moved horizontally to make it visible. top_bottom_margin Specifies the margin to establish between the top or bottom edge of the widget and the associated edge of the viewport. This margin is established only if the widget must be moved vertically to make it visible. For a complete definition of ScrolledWindow and its associated resources, see XmScrolledWindow(3) RELATED
XmScrolledWindow(3). XmScrollVisible(library call)