How to use Data of one file in another file???
Hello People,
I have two file file1.txt file2.txt,both file have content like following file1.txt Voltage and current behavior for diodes. v1 2 3 dc 5v Voltage and current behavior for transistor v2 4 5 dc 6v Voltage and current behavior for FET v3 6 7 dc 2v M.Tech(VLSI) in NIT jaipur Simulation for V-I behaviour file2.txt 2 3 4 the number in last coloumn of file1.txt should be replaced by number in file2.txt as follows,changes should be happened in line containg vn,n is integer e.g:1,2,3.........8....99...n.Result.txt file should look like as result.txt result.txt Voltage and current behavior for diodes. v1 2 3 dc 2v<-----2 is coming from file2.txt Voltage and current behavior for transistor v2 4 5 dc 3v<-----3 is coming from file2.txt Voltage and current behavior for FET v3 6 7 dc 4v<-----4 is coming from file2.txt M.Tech(VLSI) in NIT jaipur Simulation for V-I behaviour Thanks in advance Thanks and Regards |
Quote:
Which programming languages do you know and what code have you written so far ? |
I am with Sergei ... you show us yours and we will help fix it
|
Hi Sergei I know C/C++ and Shell scripting but i am just a beginner like.i want to do my work in Shell script.
I wrote this awk '{getline s < "file2.txt"; $NF=s"v"}1' file1.txt but it is not working for me...Can please help me in correcting it or give me another solution for my problem in shell script or using AWK.I will be very thankful to you. |
Quote:
|
now i am using this
awk '/^v/{getline s < "file2.txt"; $NF=s"v"}1' file1.txt it is giving my result.Can you please give some other solution for the same.thanks....you guys are very helping. |
Quote:
Does it work or not ? |
Hi sergei,
i am getting my result from this awk '/^v/{getline s < "file2.txt"; $NF=s"v"}1' file1.txt if i will face problem i will contact you people.for now problem has been resolved.Thanks for your support. |
All times are GMT -5. The time now is 05:50 PM. |