Sponsored Content
Top Forums Shell Programming and Scripting Use of sed to find everything after first match! Post 302851075 by Scott on Friday 6th of September 2013 03:38:35 PM
Old 09-06-2013
This is very similar to your previous thread. Is there a theme developing, or shall we continue in dribs and drabs?

Code:
# X=1:2:3                                                                                                 
# echo $X | sed "s/[^:]*://"
2:3
# echo ${X#*:} 
2:3

This User Gave Thanks to Scott For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how do I negate a sed match

I have a text file that has links in it. I can write a match for sed to replace the link with anything. For example: http://www.google.com becomes XxX But what I'm after is not to replace the link with something but to remove everything else and just leave the link. I want a... (5 Replies)
Discussion started by: muxman
5 Replies

2. Shell Programming and Scripting

sed: find match and delete the line above

I am searching a dhcpd.conf to find the hardware ethernet match, then once the match is found delete just the line above it. For example: testmachine.example { hardware ethernet 00:00:00:00:00:00; fixed address 192.168.1.100; next-server 192.168.1.101; filename "linux-install/pxelinux.0"; }... (3 Replies)
Discussion started by: cstovall
3 Replies

3. UNIX for Dummies Questions & Answers

using sed or grep to find exact match of text

Hi, Can anyone help me with the text editing I need here. I have a file that contains the following lines for example: (line numbers are for illustration only) 1 Hello world fantasy. 2 Hello worldfuntastic. 3 Hello world wonderful. I would like to get all those lines of text that... (5 Replies)
Discussion started by: risk_sly
5 Replies

4. Shell Programming and Scripting

How to find first match and last match in a file

Hi All, I have a below file: ================== 02:53 pravin-root 02:53 pravin-root 03:05 pravin-root 02:55 pravin1-root 02:59 pravin1-root ================== How do I find the first and last value of column 1. For example, how do I find 02:53 is the first time stamp and 03:05 is... (3 Replies)
Discussion started by: praving5
3 Replies

5. Shell Programming and Scripting

find: No match due to find command being argument

I am using csh and getting the error "find: No match." but I cannot figure out why. What I am trying to do is set the find command to a variable and then execute the variable as a command. I ran it through a debugger and it looks like $FIND is getting set but the find command can not actually be... (2 Replies)
Discussion started by: mst3k4l
2 Replies

6. UNIX for Dummies Questions & Answers

sed can't match '\n' ?!

Hi: it seems very strange. there is a file with multiple lines. After I squeezed out the consecutive blank lines (and some other text processing), somehow the sed '/\n/! d' file can not generate any output, as if it can't find any line with newline. the file is has many lines, so... (9 Replies)
Discussion started by: phil518
9 Replies

7. Shell Programming and Scripting

Find sessionids after match

Hi Guys, I need a help on writing shell scripting where I am stuck on finding keyword after a grep match. file.log (sample) line1 -> ppp dfasf adgasg session out sfsgsgsghsgh line2 -> sdaf agasg sessionid: 1234Nhsh34 sdagsjhsh srhs line3 -> sdgshytnba sessionid: 453omgt thdjdh gfhjdj... (19 Replies)
Discussion started by: TCS
19 Replies

8. Shell Programming and Scripting

sed match

Hi can anyone help with the following: echo "Date range on 5th May is between -010516 and 050516- please continue "| sed 's/\(.*-\)\(.*-\)\(.*$\)/\2/' output 010516 and 050516- What i need is to include the - to be included. Desired output: -010516 and 050516- I know... (11 Replies)
Discussion started by: andy391791
11 Replies

9. Shell Programming and Scripting

sed print from last occurrence match until the end of last occurrence match

Hi, i have file file.txt with data like: START 03:11:30 a 03:11:40 b END START 03:13:30 eee 03:13:35 fff END jjjjjjjjjjjjjjjjjjjjj START 03:14:30 eee 03:15:30 fff END ggggggggggg iiiiiiiiiiiiiiiiiiiiiiiii I want the below output START (13 Replies)
Discussion started by: Jyotshna
13 Replies

10. Shell Programming and Scripting

Getting out of sed on first NOT match

i have a large file where i want to look for any record that is is larger or smaller than 21 and if it is the case i want to report and break SED .. how can i achieve it ? i dont want sed to scan the complete file after one non match is found. (4 Replies)
Discussion started by: boncuk
4 Replies
echo(3XCURSES)						  X/Open Curses Library Functions					    echo(3XCURSES)

NAME
echo, noecho - enable/disable terminal echo SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib -R /usr/xpg4/lib -lcurses [ library... ] c89 [ flag... ] file... -lcurses [ library... ] #include <curses.h> int echo(void); int noecho(void); DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially, curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft- ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined. RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5) SunOS 5.10 5 Jun 2002 echo(3XCURSES)
All times are GMT -4. The time now is 10:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy