Sponsored Content
Full Discussion: Understanding sed
Top Forums Shell Programming and Scripting Understanding sed Post 302774009 by Scrutinizer on Friday 1st of March 2013 04:06:20 AM
Old 03-01-2013
Hi, the first one deletes the second field only if it consists of one character... It replace the first field and a colon + a character and a colon with the first field (that was captured with \( .. \) and recalled by\1) and two colons

The second replaces any number of non-colons and a colon by a colon, the number two means the it does this with the second occurrence on a line...
This User Gave Thanks to Scrutinizer For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

need further understanding of init.d

I needt o know how what init.d does and how it knows which dameons/applications to turn off and how to restart the applications after reboot. any OS - solaris/hp-ux (1 Reply)
Discussion started by: jigarlakhani
1 Replies

2. Shell Programming and Scripting

understanding the sed command

Guys, I am trying to understand the sed command here. adx001 $ a=/clocal/dctrdata/user/dctrdat1/trdroot/recouncil adx001 $ b=`echo $a | sed 's/\//\\\\\//g'` adx001 $ echo $b \/clocal\/dctrdata\/user\/dctrdat1\/trdroot\/recouncil The sed command i took it from the script. Please... (3 Replies)
Discussion started by: mac4rfree
3 Replies

3. UNIX for Dummies Questions & Answers

Help understanding sed

I am trying to create a basic script that converts an Oracle script into a Sybase script. The only things im changing are Datatypes and the to_char and to_date functions. I am not really 100% sure of the way it works. I have tried running the functions through a loop to replace each word line... (6 Replies)
Discussion started by: Makaer
6 Replies

4. Shell Programming and Scripting

need help understanding mv

I just started shell coding and I'm a bit confused on how 'mv' works can someone explain to me how it works and if i did this correctly. Thanks. echo "Enter Name of the first file:" read file1 #echo $file1 if ; then echo "Sorry, file does not exist." exit 1 ... (16 Replies)
Discussion started by: taiL
16 Replies

5. UNIX for Dummies Questions & Answers

understanding {%/*}/

Hi Gurus: I am trying to understand the following line of code.I did enough of googling to understand but no luck.Please help me understand the follow chunk of code: X=$0 MOD=${X%/*}/env.ksh X is the current script from which I am trying to execute. Say if X=test.ksh $MOD is echoing :... (3 Replies)
Discussion started by: vemana
3 Replies

6. UNIX for Dummies Questions & Answers

understanding sed command

Hi Friends, I need a small help in understanding the below sed command. $ cat t4.txt 1 root 1 58 0 888K 368K sleep 4:06 0.00% init 1 root 1 58 0 888K 368K sleep 4:06 0.00% init last $ sed 's/*$//' t4.txt 1 root 1 58 0 888K ... (3 Replies)
Discussion started by: forroughuse
3 Replies

7. Shell Programming and Scripting

help understanding regex with grep & sed

I have the following line of code that works wonders. I just don't completely understand it as I am just starting to learn regex. Can you help me understand exactly what is happening here? find . -type f | grep -v '^\.$' | sed 's!\.\/!!' (4 Replies)
Discussion started by: trogdortheburni
4 Replies

8. Shell Programming and Scripting

Need your help in understanding this

Hi, I found this in a script and I would like to know how this works Code is here: # var1=PART1_PART2 # var2=${var1##*_} # echo $var2 PART2 I'm wondering how ##* makes the Shell to understand to pick up the last value from the given. (2 Replies)
Discussion started by: sathyaonnuix
2 Replies

9. Shell Programming and Scripting

Need Quick help on Understanding sed Regex

Hi Guys, Could you please kindly explain what exactly the below SED command will do ? I am quite confused and i assumed that, sed 's/*$/ /' 1. It will remove tab and extra spaces .. with single space. The issue is if it is removing tab then it should be Î right .. please assist.... (3 Replies)
Discussion started by: Nandy
3 Replies
XtFindFile(3)							   XT FUNCTIONS 						     XtFindFile(3)

NAME
XtFindFile - search for a file using substitutions in the path list SYNTAX
String XtFindFile(String path, Substitution substitutions, Cardinal num_substitutions, XtFilePredicate predicate); ARGUMENTS
path Specifies a path of file names, including substitution characters. substitutions Specifies a list of substitutions to make into a path. num_substitutions Specifies the number of substitutions passed in. predicate Specifies a procedure to call to judge a potential file name, or NULL. DESCRIPTION
The path parameter specifies a string that consists of a series of potential file names delimited by colons. Within each name, the percent character specifies a string substitution selected by the following character. The character sequence ``%:'' specifies an embedded colon that is not a delimiter; the sequence is replaced by a single colon. The character sequence ``%%'' specifies a percent character that does not introduce a substitution; the sequence is replaced by a single percent character. If a percent character is followed by any other character, XtFindFile looks through the specified substitutions for that character in the match field and if found replaces the percent and match characters with the string in the corresponding substitution field. A substitution field entry of NULL is equivalent to a pointer to an empty string. If the operating system does not interpret multiple embedded name separators in the path (i.e., ``/'' in POSIX) the same way as a single separator, XtFindFile will collapse multiple separators into a single one after performing all string substitutions. Except for collapsing embedded separators, the contents of the string substitutions are not interpreted by XtFindFile and may therefore contain any operating-system-dependent characters, including additional name separators. Each resulting string is passed to the predicate procedure until a string is found for which the procedure returns True; this string is the return value for XtFindFile. If no string yields a True return from the predicate, XtFindFile returns NULL. If the predicate parameter is NULL, an internal procedure that checks if the file exists, is readable, and is not a directory will be used. It is the responsibility of the caller to free the returned string using XtFree when it is no longer needed. SEE ALSO
X Toolkit Intrinsics - C Language Interface Xlib - C Language X Interface X Version 11 libXt 1.1.3 XtFindFile(3)
All times are GMT -4. The time now is 07:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy