S No Site IP Address
1 Australia 192.168.0.1/26
2 Australia 192.168.0.2/26
3 Australia 192.168.0.3/26
I need awk/sed command to replace the column2 value ( under Site) with some other value ( example UK) and Column3 value ( Under IP address) needs to replaced from other file ( File 2) which has the IP address contents like this
File2
IP Address
10.100.10.1/25
10.100.10.2/23
10.100.10.3/24
So the new file File3 should be like this
S No Site IP Address
1 UK 10.100.10.1/25
2 UK 10.100.10.2/23
3 UK 10.100.10.3/24
What difference does it make whether or not you use File1? It seem that all you have in File3 is a new header line, a line sequence number, a random string that the script makes up on the fly, and the contents of File2.
You did not answer Don Cragun's question on homework assignment, nor did you show any efforts from your side. So all hints I can give you for now is to skip file1 and read file2 in a loop, adding the two desired columns to each line before printing it out.
Please be somewhat creative and consult a dictionary for exact translations of homework assignment. If you are a student and your teacher gives you problems to solve off class times, that's homework.
And, as long as you don't show some efforts from your side to tackle the problem, little help can/will be offered from our side.
I'm not sure I understand your problem. Setting OFS to <TAB> will certainly separate all output fields with <TAB>s. What delimiter do you want, and where?
The submitter refuses to answer the homework question, so I have to assume that this is homework and the submitter is trying to get us to do the homework without following the proper procedures. Refusing to use CODE tags isn't helping either.