Sponsored Content
Full Discussion: script puts;; I need just ;
Top Forums Shell Programming and Scripting script puts;; I need just ; Post 302598162 by durden_tyler on Monday 13th of February 2012 03:03:11 PM
Old 02-13-2012
Quote:
Originally Posted by richsark
Yes the original file did have a ; already:

option domain-name-servers addnsr1pri.fs.rich.us., addnsr1sec.fs.rich.us.;

after script run:
option domain-name-servers 126.7.3.101, 166.2.100.78;;

input-file.txt looks like:

HTML Code:
addnsr1pri.fs.rich.us          126.7.3.101
addnsr1sec.fs.rich.us         126.2.100.78
...
In that case, remove the ";" after "$1" from your script.
That is, change the following line:

Code:
s/^(option\s+domain-name-servers\s.*)/$1;/ && s/([\w.]*\w)\.?/$ip{$1}||$1/eg;

so that it looks like this -

Code:
s/^(option\s+domain-name-servers\s.*)/$1/ && s/([\w.]*\w)\.?/$ip{$1}||$1/eg;

tyler_durden

In fact, the first s/// operator simply substitutes a matched line by itself, so you could shorten that line to this -

Code:
/^option\s+domain-name-servers\s.*/ && s/([\w.]*\w)\.?/$ip{$1}||$1/eg;


Last edited by durden_tyler; 02-13-2012 at 04:09 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Puts command in a script

Hi, I am trying to output a set of fields to a file: set outFile "printHeader.tmp" set dbFields "REPORT.TIMESTAMP.s,REPORT.CUSTOMER.s,REPORT.CODE.s" puts $dbFields > $outFile I receive the following error message: bad argument "printHeader.tmp": should be "nonewline" ... (2 Replies)
Discussion started by: MrG-San
2 Replies

2. UNIX and Linux Applications

Oracle Pipe Puts

Hello All, Can someone explain what is meant by "pipe puts" in Oracle?? Thanks (1 Reply)
Discussion started by: nareshprasannar
1 Replies

3. Shell Programming and Scripting

awk puts newline between fields

I have a='123, abc, def, ghi' var1=`echo $a | awk -F", " '{print RS $1}'` echo "something: $var1" which outputs something 123 how can I tell awk not to put a newline between fields? I want it to output: something: 123 (4 Replies)
Discussion started by: unclecameron
4 Replies

4. Shell Programming and Scripting

TCL/Expect using puts to add data to a file

Hi all, I'm trying to do something that might be basic, but it is not working for me, and I suspect I'm missing something. I appreciate if you can shed a light or offer an alternative. In expect script, I'm opening a file i.e: set file I have a simple proc: proc a {} { puts "Hello... (3 Replies)
Discussion started by: ydekel
3 Replies

5. Shell Programming and Scripting

script to detect a file from inserted usb and puts into a Variable

There is a same named log file that I have on my 2 different android phones. When I plug it into my computer, it appears in the media folder, For example the first android phone: /media/F6BA-0AF5/folder/A.log I want to put that into a variable to be manipulated.... (3 Replies)
Discussion started by: tobenguyen
3 Replies

6. UNIX and Linux Applications

Gvim doesn't suggest filenames with :e TAB, puts ^I instead

Hello all, When I type :e in vim and then press TAB, vim suggests filenames in that directory. However, when I do the same in gvim, it instead shows ^I for every TAB press instead of suggesting filenames. Anyone know what's going on here ? Thanks in advance. ChandlerAZ ---------- Post... (0 Replies)
Discussion started by: chandleraz
0 Replies

7. Shell Programming and Scripting

Bash script puts \r at the end of variable

I'm pretty new to bash scripts and I'm trying to work through some issues. Would appreciate any suggestions. I have a list of servers in a text file (I used the FQDN's), I assign the file name to a variable, I then use cat to read the list of file names and echo them to the screen. But when it... (2 Replies)
Discussion started by: westmoreland
2 Replies

8. Shell Programming and Scripting

Script that gathers specific values from files and puts it into HTML to send e-mail

Hi All, Sorry for long topic here. So the drill goes like that, I need a script which gathers different values from different files/locations. A_CT=`cat a.dat | awk -F'|' '{print $1}' >> report.txt` B_CT=`cat b.dat | awk -F'|' '{print $3}' >> report.txt` C_CT=`cat c.dat | awk -F'|'... (4 Replies)
Discussion started by: shivakid
4 Replies

9. What is on Your Mind?

Puts a new dimension on divide by zero... ;o)

Enjoy... Watch What Happens If You Try To Divide By Zero On This Mechanical Calculator | IFLScience (0 Replies)
Discussion started by: wisecracker
0 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 01:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy