Sponsored Content
Top Forums Shell Programming and Scripting sed - deleting each line up to a word Post 302511694 by sk1418 on Thursday 7th of April 2011 10:34:17 AM
Old 04-07-2011
sorry, didn't read your post carefully just now. is this what you want?
Code:
kent$ echo "test
test test mounting hello
test mounting hello
mounting works
" | sed -r '/ok/{s/^.*(mounting.*$)/\1/}'
test
mounting hello
mounting hello
mounting works


Last edited by sk1418; 04-07-2011 at 11:40 AM.. Reason: change "ok" -> "mounting"
This User Gave Thanks to sk1418 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

put each word in new line - sed or tr

Hello ! I have a result of ls command in a file: file1 file2 file3.out file4.pdf file5 they all are separated by space. I need to put them on a separate line example: file1 file2 file3.out file4.pdf fil35 i tried sed 's/ /\n/g' inputfile > outputfile but did not help (3 Replies)
Discussion started by: hemangjani
3 Replies

2. Shell Programming and Scripting

deleting particular lines and moving a line up using perl/sed

Hi, I need convert a dump file in the following format : (please note that line numbers are provided for easy look) Original file: 1 2007-10-2482.90 No trade 0 0.00 100000.00 2 100000.00 3 0.00 4 HOLD 5 2007-10-2589.75 Bought 1114 1114 100000.00 0.00 ... (5 Replies)
Discussion started by: sabyasm
5 Replies

3. Shell Programming and Scripting

Deleting a line from a file with sed and awk?

cat file.txt fvnuiehuewf ruevhxncvkjrh zxjvurhfuwe jkhvBEGINvfnvf ijrgioe Trying to delete a line that has the pattern "BEGIN" cat sedtest filename=file.txt pattern=BEGIN sed "/^$pattern/d" "$filename" (9 Replies)
Discussion started by: cola
9 Replies

4. Shell Programming and Scripting

deleting blank line and row containing certain words in single sed command

Hi Is it possible to do the following in a single command /usr/xpg4/bin/sed -e '/rows selected/d' /aemu/CALLAUTO/callauto.txt > /aemu/CALLAUTO/callautonew.txt /usr/xpg4/bin/sed -e '/^$/d' /aemu/CALLAUTO/callautonew.txt > /aemu/CALLAUTO/callauto_new.txt exit (1 Reply)
Discussion started by: aemunathan
1 Replies

5. Shell Programming and Scripting

sed: break before word if it's not last on the line

I've been trying this, and can't get it right. I want to put a line break before a word, but only if it's *not* the last word in the line. So if the break work was "fish," then... We want to fish tomorrow ...would become... We want to fish tomorrow ...but this line would remain... (3 Replies)
Discussion started by: estebandido
3 Replies

6. UNIX for Dummies Questions & Answers

How to print line starts with specific word and contains specific word using sed?

Hi, I have gone through may posts and dint find exact solution for my requirement. I have file which consists below data and same file have lot of other data. <MAPPING DESCRIPTION ='' ISVALID ='YES' NAME='m_TASK_UPDATE' OBJECTVERSION ='1'> <MAPPING DESCRIPTION ='' ISVALID ='NO'... (11 Replies)
Discussion started by: tmalik79
11 Replies

7. UNIX for Dummies Questions & Answers

How to delete a particular word on particular line with sed?

I have a file from which I am trying to delete a particular word on a particular line. NEW NEW /v/engine NEW /ifs/list NEW /ifs/vdrome NEW I am trying to delete the first line only if it contains the word NEW. I am also trying to delete the last line only if it contains the word NEW. I... (11 Replies)
Discussion started by: newbie2010
11 Replies

8. Shell Programming and Scripting

sed command throwing error while deleting a line from a file

Hi all, I ahve a program which has to delete a line in a file... if i run the sed command through shell prompt it works fine. But if run it using code its throwing error. May i know where i am doing wrong. the file has 3 lines # cat /root/.ssh/known_hosts... (4 Replies)
Discussion started by: vivek d r
4 Replies

9. Shell Programming and Scripting

Using sed for deleting the first word of each line?

sed /'1-2'/&^/ filename suppose there is a file containing three lines , how do we do delete the word from each line? hyter efr frf rerfer efe ewd cdcf evrfgf erfv the output has to look like frf ewd erfv (2 Replies)
Discussion started by: Rajeev Nukala
2 Replies

10. Shell Programming and Scripting

sed command within script wrongly deleting the last line

Hi, I have a shell script which has a for loop that scans list of files and do find and replace few variables using sed command. While doing this, it deletes the last line of all input file which is something wrong. how to fix this. please suggest. When i add an empty line in all my input file,... (5 Replies)
Discussion started by: rbalaj16
5 Replies
ncpmap(8)							       NCPFS								 ncpmap(8)

NAME
ncpmap - mounts some resource from Netware server or tree previously connected with ncplogin SYNOPSIS
ncpmap [OPTIONS] [-a] [mount-point] DESCRIPTION
ncplogin and ncpmap provide a way to split the ncpmount operation into halves, with ncpmap mounting the resource previously authenticated with ncplogin. OPTIONS
mount_point is optional if you specify the -a option. -T tree Tree name to be used. -S server Server name to be used. The -T and -S options are mutually exclusive. -X name_ctx Default name context to be used. -E Echo value of final mount_point. -V volume Volume to mount. This must be in binary format if -S server, or in NDS format if -T tree. -R path Path in volume to "map root." -f mode Permission given the files, in octal notation. -d mode Permission given the directories, in octal notation. -t time_out Waiting time, in 1/100s of a second, to wait for an answer from the server. Default is 60. -r retry_count Number of retry attempts. Default is 5. -s Enable renaming or deletion of read-only files. -h Print help text. -v Print ncpfs version number. -i level Signature level. 0 = never, 1 = supported, 2 = preferred, and 3 = required. -N os2,nfs Do not use specified namespaces on mounted volume. -y charset Character set used for input and display. -p codepage Codepage used on volume, including letters "cp." -B bcast Broadcast mode. 0 = all, 1 = console, and 2 = none. Default is all. -a Autocreate mounting point if needed in ~/ncp/SERVER/VOLUME. -l Autocreate mounting point if needed in /mnt/ncp/SERVER/VOLUME. SECURITY
ncpmap must be setuid to permit non-root users use of it. In these cases, it will enforce nodev and nosetuid mount options. SEE ALSO
ncplogin(1), ncpmount(8) AUTHOR
Manpage written by Rodrigo Rubira Branco <rrbranco@br.ibm.com> with Petr Vandrovec <petr@vandrovec.name>. NCPFS
Jun, 01 2006 ncpmap(8)
All times are GMT -4. The time now is 03:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy