Inserting records in bash script [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
This question already has an answer here:
Inserting A records in dns zone [closed]
2 answers
Any feedback will be appreciated.
I would like to insert the IP address, however the script is inserting the domain name instead of IP.
File name: file.txt
dns50.com: 1.1.1.1
dns51.com: 2.2.2.2
dns52.com: 3.3.3.3
Script:
for x in `cat /root/file.txt | cut -d: -f1` ; do
echo "ns1 14400 IN A $x" >> /var/named/$x.db
done
Inserted data when running the about script.
file: /var/named/dns50.com.db
ns1 14400 IN A dns50.com
file: /var/named/dns51.com.db
ns1 14400 IN A dns51.com
file: /var/named/dns52.com.db
ns1 14400 IN A dns52.com
But we would like to insert the following data
file: /var/named/dns50.com.db
ns1 14400 IN A 1.1.1.1
file: /var/named/dns51.com.db
ns1 14400 IN A 2.2.2.2
file: /var/named/dns52.com.db
ns1 14400 IN A 3.3.3.3
bash scripting
marked as duplicate by Jeff Schaller, schily, slmâ¦
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Jul 11 at 13:28
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
1
down vote
favorite
This question already has an answer here:
Inserting A records in dns zone [closed]
2 answers
Any feedback will be appreciated.
I would like to insert the IP address, however the script is inserting the domain name instead of IP.
File name: file.txt
dns50.com: 1.1.1.1
dns51.com: 2.2.2.2
dns52.com: 3.3.3.3
Script:
for x in `cat /root/file.txt | cut -d: -f1` ; do
echo "ns1 14400 IN A $x" >> /var/named/$x.db
done
Inserted data when running the about script.
file: /var/named/dns50.com.db
ns1 14400 IN A dns50.com
file: /var/named/dns51.com.db
ns1 14400 IN A dns51.com
file: /var/named/dns52.com.db
ns1 14400 IN A dns52.com
But we would like to insert the following data
file: /var/named/dns50.com.db
ns1 14400 IN A 1.1.1.1
file: /var/named/dns51.com.db
ns1 14400 IN A 2.2.2.2
file: /var/named/dns52.com.db
ns1 14400 IN A 3.3.3.3
bash scripting
marked as duplicate by Jeff Schaller, schily, slmâ¦
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Jul 11 at 13:28
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
This question already has an answer here:
Inserting A records in dns zone [closed]
2 answers
Any feedback will be appreciated.
I would like to insert the IP address, however the script is inserting the domain name instead of IP.
File name: file.txt
dns50.com: 1.1.1.1
dns51.com: 2.2.2.2
dns52.com: 3.3.3.3
Script:
for x in `cat /root/file.txt | cut -d: -f1` ; do
echo "ns1 14400 IN A $x" >> /var/named/$x.db
done
Inserted data when running the about script.
file: /var/named/dns50.com.db
ns1 14400 IN A dns50.com
file: /var/named/dns51.com.db
ns1 14400 IN A dns51.com
file: /var/named/dns52.com.db
ns1 14400 IN A dns52.com
But we would like to insert the following data
file: /var/named/dns50.com.db
ns1 14400 IN A 1.1.1.1
file: /var/named/dns51.com.db
ns1 14400 IN A 2.2.2.2
file: /var/named/dns52.com.db
ns1 14400 IN A 3.3.3.3
bash scripting
This question already has an answer here:
Inserting A records in dns zone [closed]
2 answers
Any feedback will be appreciated.
I would like to insert the IP address, however the script is inserting the domain name instead of IP.
File name: file.txt
dns50.com: 1.1.1.1
dns51.com: 2.2.2.2
dns52.com: 3.3.3.3
Script:
for x in `cat /root/file.txt | cut -d: -f1` ; do
echo "ns1 14400 IN A $x" >> /var/named/$x.db
done
Inserted data when running the about script.
file: /var/named/dns50.com.db
ns1 14400 IN A dns50.com
file: /var/named/dns51.com.db
ns1 14400 IN A dns51.com
file: /var/named/dns52.com.db
ns1 14400 IN A dns52.com
But we would like to insert the following data
file: /var/named/dns50.com.db
ns1 14400 IN A 1.1.1.1
file: /var/named/dns51.com.db
ns1 14400 IN A 2.2.2.2
file: /var/named/dns52.com.db
ns1 14400 IN A 3.3.3.3
This question already has an answer here:
Inserting A records in dns zone [closed]
2 answers
bash scripting
edited Jul 11 at 9:01
agc
3,9991935
3,9991935
asked Jul 11 at 8:51
techforever92
66
66
marked as duplicate by Jeff Schaller, schily, slmâ¦
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Jul 11 at 13:28
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Jeff Schaller, schily, slmâ¦
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Jul 11 at 13:28
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
while IFS=': ' read a b ; do
echo "ns1 14400 IN A $b" >> /var/named/$a.db
done
Thank you for your reply. We were able to run it using the below mentioned command # while IFS=': ' read a b ; do echo "ns1 14400 IN A $b" >> /var/named/$a.db; done <file
â techforever92
Jul 12 at 6:57
add a comment |Â
up vote
1
down vote
you can try this following awk command.
awk -F: 'print "ns1 14400 IN A "$2 > $1.db' file.txt
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
while IFS=': ' read a b ; do
echo "ns1 14400 IN A $b" >> /var/named/$a.db
done
Thank you for your reply. We were able to run it using the below mentioned command # while IFS=': ' read a b ; do echo "ns1 14400 IN A $b" >> /var/named/$a.db; done <file
â techforever92
Jul 12 at 6:57
add a comment |Â
up vote
2
down vote
while IFS=': ' read a b ; do
echo "ns1 14400 IN A $b" >> /var/named/$a.db
done
Thank you for your reply. We were able to run it using the below mentioned command # while IFS=': ' read a b ; do echo "ns1 14400 IN A $b" >> /var/named/$a.db; done <file
â techforever92
Jul 12 at 6:57
add a comment |Â
up vote
2
down vote
up vote
2
down vote
while IFS=': ' read a b ; do
echo "ns1 14400 IN A $b" >> /var/named/$a.db
done
while IFS=': ' read a b ; do
echo "ns1 14400 IN A $b" >> /var/named/$a.db
done
answered Jul 11 at 9:11
agc
3,9991935
3,9991935
Thank you for your reply. We were able to run it using the below mentioned command # while IFS=': ' read a b ; do echo "ns1 14400 IN A $b" >> /var/named/$a.db; done <file
â techforever92
Jul 12 at 6:57
add a comment |Â
Thank you for your reply. We were able to run it using the below mentioned command # while IFS=': ' read a b ; do echo "ns1 14400 IN A $b" >> /var/named/$a.db; done <file
â techforever92
Jul 12 at 6:57
Thank you for your reply. We were able to run it using the below mentioned command # while IFS=': ' read a b ; do echo "ns1 14400 IN A $b" >> /var/named/$a.db; done <file
â techforever92
Jul 12 at 6:57
Thank you for your reply. We were able to run it using the below mentioned command # while IFS=': ' read a b ; do echo "ns1 14400 IN A $b" >> /var/named/$a.db; done <file
â techforever92
Jul 12 at 6:57
add a comment |Â
up vote
1
down vote
you can try this following awk command.
awk -F: 'print "ns1 14400 IN A "$2 > $1.db' file.txt
add a comment |Â
up vote
1
down vote
you can try this following awk command.
awk -F: 'print "ns1 14400 IN A "$2 > $1.db' file.txt
add a comment |Â
up vote
1
down vote
up vote
1
down vote
you can try this following awk command.
awk -F: 'print "ns1 14400 IN A "$2 > $1.db' file.txt
you can try this following awk command.
awk -F: 'print "ns1 14400 IN A "$2 > $1.db' file.txt
answered Jul 11 at 9:10
Kamaraj
2,5341312
2,5341312
add a comment |Â
add a comment |Â