I am facing a problem in replacing the file contents by iterating through the list.
My present code:
Code:
and my
country code file contains some county code on line basis, seperated with commas.
Here after executing the script, only last country code is replacing with its country name. And if I change > (overwriting) to >> (appending) then same contents, multiple times with changes are appending to output file. I request you to suggest a solution for this.
And my second concern is that I have to append the name of the file at the end of each line, which I hav done using the commented line. Request you to suggest to perform both actions at a stretch.
i've reworked some code from an earlier post, and it isn't working as expected
i've simplified it to try and find the problem. i spent hours trying to figure out what is wrong, eventually thinking there was a bug in perl or a problem with my computer. but, i've tried it on 3 machines with the... (5 Replies)
I have a Bash script on Cygwin that tries to iterate through the directory entries in PATH. I need to convert the PATH value to a form that I can iterate through with "for var in $list; do".
For instance, an excerpt from my PATH value is this:
:/c/Program Files/Windows Imaging/:/c/Program... (2 Replies)
hi all,
i am writing a ksh script, i am logging into an oracle db via sqlplus and running a select statement but i dont know how i can store the results from the sql so i can iterate over it and do more operations over it. I dont want to write a stored procedure with a cursor since i need to... (2 Replies)
Hey everyone.
Is it possible to use two arrays in a loop?
Basically what I am trying to do is iterate through the elements in an array, and, based on a condition, use the current position in the array to point to that index in the array. Here's the loop structure I'm looking for:
... (1 Reply)
Whilst creating the function readjust_descr I have stumble across what may be a problem or
something that might just work. I was hoping someone could look at the code below and tell me
if readjust_descr will clear all null pointers from the structure descr_list.
struct descr descr_list =... (6 Replies)
Hello, I am working on a coding project for a class and to test the program I have created, I have come up with 100 different test cases. The program takes four text files as input, so each of the test cases is contained in a folder with four files.
I have a folder called 'tests', within which... (1 Reply)
Hi,
I've recently started using Awk commands as i need it to pull information out of a file and give me the mean value of a series of numbers. Here is the code i run on my Infile and it works just fine.
awk '{if ($1 == "Mam189") print $0}' Infile | awk '{if ($1 != $2) print $0}' | awk... (5 Replies)
I am trying to look through one of my directories to remove certain files. I am pretty new to Unix and bash so I just need a little help in starting this. I know I would have to write two loops one to iterate the directories and one to iterate the files. How would I write the loops? (3 Replies)
I need to run the same awk function over an entire directly of files.
This is the awk:
awk '{$(NF+1)=1}1'
Is there a way that I can run this command once over all of the files, along the lines of:
awk '{$(NF+1)=1}1' *
so that I do not have to run this several times?
My main concern is... (2 Replies)
Hi,
I am trying to do something similar to the for loop example from KSH For Loop Array: Iterate Through Array Values
$: cat y.ksh
#!/bin/ksh
# set array called nameservers
set -A nameservers 192.168.1.1 192.168.1.5 202.54.1.5
# print all name servers
for i in ${nameservers}
do
... (3 Replies)