Sponsored Content
Top Forums Shell Programming and Scripting Using Sed to Delete Words in a File Post 302503684 by SkySmart on Friday 11th of March 2011 10:14:01 AM
Old 03-11-2011
Quote:
Originally Posted by Franklin52
Post an example of the file Servers.txt and the hostgroups.cfg file.

hostgroups.cfg:

There are several chunks similar to this in the hostgroups.cfg file.

Code:
define hostgroup {
      alias PRODUCTION
      hostgroup_name staged-hosts
      members     lht-rater-09.medy0.s.blah.net,db-tools-01.kedy0.s.blah.net,lhtgen-13.kedy0.s.blah.net,lhtgen-13.kedy0.s.blah.net,lhtgen-14.kedy0.s.blah.net,lhtgen-15.kedy0.s.blah.net,lhtgen-16.kedy0.s.blah.net,lhtgen-15.bedy0.s.blah.net,lhtgen-16.bedy0.s.blah.net,lhtgen-18.kedy0.s.blah.net,lhtgen-19.kedy0.s.blah.net,edge-evntpr-02.medy0.s.blah.net,edge-evntpr-04.medy0.s.blah.net,wifi-evntpr-01.vedy0.s,wifi-evntpr-02.vedy0.s,wifi-evntpr-03.vedy0.s,wifi-evntpr-04.vedy0.s,edge-evntpr-01.kedy0.s.blah.net,edge-evntpr-02.kedy0.s.blah.net,edge-tpr-03.kedy0.s.blah.net,edge-evntpr-04.kedy0.s.blah.net,edge-tpr-01.bedy0.s.blah.net,edge-evntpr-02.bedy0.s.blah.net,edge-tpr-03.bedy0.s.blah.net,edge-evntpr-04.bedy0.s.blah.net,edge-tpr-01.medy0.s.blah.net,edge-evntpr-03.medy0.s.blah.net
      use test-hostgroup
      }


Servers.txt:

Code:
edge-tpr-02.kedy0.s.blah.net
edge-tpr-03.kedy0.s.blah.net
edge-tpr-04.kedy0.s.blah.net
edge-tpr-01.bedy0.s.blah.net
edge-tpr-02.bedy0.s.blah.net
edge-tpr-03.bedy0.s.blah.net
edge-tpr-04.bedy0.s.blah.net
edge-tpr-01.medy0.s.blah.net
edge-evntpr-03.medy0.s.blah.net


Last edited by SkySmart; 03-11-2011 at 11:27 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sed option to delete two words within a file

Could someone please help me with the following. I'm trying to figure out how to delete two words within a specific file using sed. The two words are directory and named. I have tried the following: sed '//d' sedfile sed '//d' sedfile both of these options do not work..... ... (4 Replies)
Discussion started by: klannon
4 Replies

2. UNIX for Dummies Questions & Answers

sed [delete everything between two words]

Hi, I have the following codes below that aims to delete every words between two pattern word. Say I have the files To delete every word between WISH_LIST=" and " I used the below codes (but its not working): #!/bin/sh sed ' /WISH_LIST=\"/ { N /\n.*\"/ {... (3 Replies)
Discussion started by: Orbix
3 Replies

3. UNIX for Dummies Questions & Answers

sed replace words in file and keep some

lets see if i can explain this in a good way. im trying to replace some words in a file but i need to know what the words are that is beeing replaced. not sure if sed can do this. file.name.something.1DATA01.something.whatever sed "s/./.DATA?????/g" need to know what the first . is... (2 Replies)
Discussion started by: cas
2 Replies

4. UNIX for Advanced & Expert Users

How to delete first 10 words from file

Hi, Could you please let me know, how to delete first 10 words from text files using vi? 10dw will delete it from current line, how to do it for all the lines from file? Thanks (6 Replies)
Discussion started by: sentak
6 Replies

5. Shell Programming and Scripting

How can i delete some words in every line in a file

Hi, I need help to delete a few words in every line in my file. This is how the file look like: VDC DQ 14900098,,,,157426.06849776753,786693.2919373367 10273032,,,,157525.49445429695,776574.5546672409 VDC DG ,10273033,,3er55,,149565.57096061576,801778.9379555212 AS174 892562,,,,, ... (2 Replies)
Discussion started by: andy_s
2 Replies

6. Shell Programming and Scripting

Need to delete words in a file

Hi All, I have an input file a.txt which contains the following :: 08-08-09 1:00 PM 763763762 f00_unix1_server.txt i Just need to delete all the words which is before f Output :: f00_unix1_server.txt Thanks (4 Replies)
Discussion started by: raghav1982
4 Replies

7. Shell Programming and Scripting

sed/awk: Delete matching words leaving only the first instance

I have an input text that looks like this (comes already sorted): on Caturday 22 at 10:15, some event on Caturday 22 at 10:15, some other event on Caturday 22 at 21:30, even more events on Funday 23 at 11:00, yet another event I need to delete all the matching words between the lines, from... (2 Replies)
Discussion started by: GrinningArmor
2 Replies

8. UNIX for Dummies Questions & Answers

sed how to delete between two words within a file

I'm hoping someone could help me out please :) I have several .txt files with several hundred lines in each that look like this: 10241;</td><td>10241</td><td class="b">x2801;</td><td>2801</td><td>TEXT-1</td></tr> 10242;</td><td>10242</td><td... (4 Replies)
Discussion started by: martinsmith
4 Replies

9. UNIX for Dummies Questions & Answers

Vim help - delete words in a file or characters after pattern

I have a file with words that begin with character #. Whenver that character is found that word should be deleted throughout the file. How do I do that in VIM. e.g: afkajfa ladfa ljafa #222222 kjafad ljl afajkj kjlj uouu #44444 jlkj lkjl Output should be afkajfa ladfa ljafa kjafad... (1 Reply)
Discussion started by: osbourneric
1 Replies

10. Shell Programming and Scripting

SED - delete words between two possible words

Hi all, I want to make an script using sed that removes everything between 'begin' (including the line that has it) and 'end1' or 'end2', not removing this line. Let me paste an 2 examples: anything before any string begin few lines of content end1 anything after anything before any... (4 Replies)
Discussion started by: meuser
4 Replies
Text::QRCode(3pm)					User Contributed Perl Documentation					 Text::QRCode(3pm)

NAME
Text::QRCode - Generate text base QR Code SYNOPSIS
use Text::QRCode; my $arrayref = Text::QRCode->new()->plot("Some text here."); print join " ", map { join '', @$_ } @$arrayref; # You will get following output. ******* * ** ******* * * * * * * * *** * * *** * * *** * ** * *** * * *** * * * * *** * * * **** * * ******* * * * ******* * ** ** ** * *** * * * ** *** * * * **** * * ** * * * * * * ** *** ** * *** ** ** * ** * ** * ******* ***** *** * * * ** * **** * *** * * * * * * *** * * ** * * * *** * *** * *** * * ** * * *** ******* * * **** DESCRIPTION
This module allows you to generate QR Code using ' ' and '*'. This module use libqrencode '2.0.0' and above. METHODS
new $qrcode = Text::QRCode->new(%params); The "new()" constructor method instantiates a new Text::QRCode object. "new()" accepts some parameters are the same as "Imager::QRCode". plot($text) $arrayref = $qrcode->plot("blah blah"); Create a QR Code map. This method returns array reference ploted QR Code with the given text. INSTANT METHODS
plot_qrcode($text, \%params) Instant method. $text is input text. %params is same parameter as "new()". SEE ALSO
"Imager::QRCode", "Term::QRCode", "HTML::QRCode", "http://www.qrcode.com/", "http://megaui.net/fukuchi/works/qrencode/index.en.html" AUTHOR
Yoshiki Kurihara "<kurihara __at__ cpan.org>" LICENCE
Copyright (c) 2007, Yoshiki KURIHARA "<kurihara __at__ cpan.org>". This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-11-15 Text::QRCode(3pm)
All times are GMT -4. The time now is 09:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy