Your request for help is a bit confusing. I'm assuming that you want to take a string with comma separated values and convert the values into bar separated fields. Further, if the field is quoted, then it may contain commas which do not indicate a field. Thus:
would be translated to:
If that is what you are looking for, then this sed programme will do it:
It does not handle input with < or > characters. If you are not using a BSD or AT&T AST version of sed, then you'll need to replace -E with -r on the command.
Edit -- with small change, the original input you presented can be processed and passed to awk or other programme:
Hi,
I have a main loop which calls a sub loop, which finally returns to the main loop itself. The main loop runs when a flag is set. Now, I have a signal handler for SIGINT, which resets the flag and thus stops the main loop. Suppose I send SIGINT while the program is in subloop, I get an error... (1 Reply)
Dear Scripting experts,
I have a problem which i cannot get my head around and wondered if anyone can help me. I have two files "file1" and "file2" and i want to replace column one from file 1 with column one with file2.(where file two has many columns). see example.. ive tried to use cut and... (4 Replies)
Hello,
i am using the sigaction function to handle the SIGCHLD signal.Is it possible to use a class member function as the handler function (the sa_handler member of the sigaction structure)?
The function's signature is:
void (*sa_handler)(int);so i don't think i can use a static member function... (2 Replies)
hello everyone....
script is: To convert the contents of a database file into uppercase
my code is:
printf "%s\n" , $2 | awk '{print toupper($2)}' emp.lst
i m able to do only for one field.....didn't get any sources for handling multiple fields.
please suggest me for multiple... (1 Reply)
Hi,
I have an issue that I am trying to resolve using arrays in awk. I have two files, the first one is a dictionary with this format:
FILE 1 (dictionary)
'Abrir' 'Open'
'Aceptar' 'Accept'
Every line has two fields, a word in two languages.
The second file is a simple list of... (3 Replies)
I want to execute awk command without quotes.
who am i | awk {'print $2'}
above code should be something like:
who am i | awk {print $2}
Why such weird requirement?
Im assigning command to a variable, hence i need to escape the quotes.
e.g:
x='who am i | awk {\'print $2\'}'
I want... (11 Replies)
I have a text file where each field is enclosed in double quotes and separated by a comma.
But in certain rows we have embedded double quotes within column data
For e.g
"""TRUSPICE CENTRE"" CLAYTON AU"
The above value is for a single column but there are embedded quotes within... (2 Replies)
Hello, i had a problem running a script , and after investigation found its all to do with the quotes:
cat file1
line1
val1
val2
line2
val1
val2
line3
val1
val2
awk 'BEGIN {RS="\n\n"; FS="\n";} {print $1 $2}' file1
This gives me the wrong output: (5 Replies)
Hi,
I am having script which contains many functions. Need to print each function name at the starting of the function. Like below,
functionname()
{
echo "functionname"
commands....
}
I've tried like below,
func=`grep "()" scriptname | cut -d "(" -f1`
for i in $func
do
nawk -v... (4 Replies)