09-11-2012
names[$i]=${names[$i]}","; done
Here instead of ${names[$i]} i have a variable $var1 which has different values in each iteration. I want to append comma after the value of $var1 and then store it in a array.
Is it possible?
Regards
Mrunal
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hello
A small shell scripting help..
I have a file say with 5 lines of text (text file).
At the end of everyline I need to add a comma at the end of the file.
Thanks, ST2000 (4 Replies)
Discussion started by: ST2000
4 Replies
2. UNIX for Dummies Questions & Answers
I have a file like this
101223345
23232344a
1312a3441
903821224
143434324
101223345
23232344a
1312a3441
I want to insert comma in 5 digit.
it should be like
10122,3345
23232,344a
how can I do this ?
thanks
Alice... (3 Replies)
Discussion started by: alisevA3
3 Replies
3. Shell Programming and Scripting
I'm attempting to create a KSH array out of a string like this: ",,,value1,value2,,"
I have created the array but I only get two elements, one for value1 and one for value2.
I have ended up with something like this but I don't like it:
set -A JUNK
xx=0
for i in $(print ",,,value1,value2,,"... (3 Replies)
Discussion started by: tmarikle
3 Replies
4. UNIX for Dummies Questions & Answers
Hello,
I have been stuck on this aspect of loading a comma delimited file into an array. I thought i had the syntax right, but my commands are not working the way I want them to. Basically my cut command is splitting the file up by spaces and commas. I want the cut command to ignore white spaces.... (2 Replies)
Discussion started by: grandtheftander
2 Replies
5. UNIX for Dummies Questions & Answers
Srr for being pain her
let say i have a data in a file like this
1@1000
2@2000
4@4000
5@7770
6@8998
7@80008
i am a newbie in Unix
i need to add a comma to integer using AWK function. for example, 1,000 or 80,008
how can i do that
ps. i'm using bash shell (1 Reply)
Discussion started by: Nutter
1 Replies
6. Shell Programming and Scripting
I am in the process of creating a BASH shell scripts for a project at work. So the scenario is as such:
I have a file with each line entry separated by ':'
... (3 Replies)
Discussion started by: metallica1973
3 Replies
7. Shell Programming and Scripting
Example data
Gi1/10
Gi1/12 xl32lytscb07
3/11 to nyc
3/12 41764 ecomm
3/13 hxcsxsa 2/1
3/14 ziim570-rsvd
3/15 xl3NDSADM
Po1 VPC trunk to xl3-i
Po2 ***DO NOT ENABLE**
Po13 *** VPC link to
Po101
Po102 xl3-2lyg1accsgh-fe... (7 Replies)
Discussion started by: sumguy
7 Replies
8. Shell Programming and Scripting
hi,
i have a variable which contains some file names separated by comma. example
FNAME="abc.txt,def.txt,ghi.txt"
i want to extract each filename and store it into an array and also count the number of files in the array.
file=abc.txt
file=def.txt
file=ghi.txt
i thought of using the... (8 Replies)
Discussion started by: Little
8 Replies
9. Shell Programming and Scripting
Hi,
00000119EEEC3F25 feedoor 20171103
0000011A4F152077 feedard 20171024
00000191FA295F61 feedzipperhola 20171023
00000213C57BB856 feedriodapple 20171005
0000025F778EF9D5 joobakoolrk 20171004
I needed the result as:
"00000119EEEC3F25", "feedoor", ... (9 Replies)
Discussion started by: ashokvpp
9 Replies
10. Shell Programming and Scripting
Hi Experts,
Please support
I have below data in file in comma seperated, but 4th column is containing comma in between numbers, bcz of which when i tried to parse the file the column 6th value(5049641141) is being removed from the file and value(222.82) in column 5 becoming value of column6.
... (3 Replies)
Discussion started by: as7951
3 Replies
LEARN ABOUT FREEBSD
file2c
FILE2C(1) BSD General Commands Manual FILE2C(1)
NAME
file2c -- convert file to c-source
SYNOPSIS
file2c [-sx] [-n count] [prefix [suffix]]
DESCRIPTION
The file2c utility reads a file from stdin and writes it to stdout, converting each byte to its decimal or hexadecimal representation on the
fly. The byte values are separated by a comma. This also means that the last byte value is not followed by a comma. By default the byte
values are printed in decimal, but when the -x option is given, the values will be printed in hexadecimal. When -s option is given, each
line is printed with a leading tab and each comma is followed by a space except for the last one on the line.
If more than 70 characters are printed on the same line, that line is ended and the output continues on the next line. With the -n option
this can be made to happen after the specified number of byte values have been printed. The length of the line will not be considered any-
more. To have all the byte values printed on the same line, give the -n option a negative number.
A prefix and suffix strings can be printed before and after the byte values (resp.) If a suffix is to be printed, a prefix must also be
specified. The first non-option word is the prefix, which may optionally be followed by a word that is to be used as the suffix.
This program is typically used to embed binary files into C source files. The prefix is used to define an array type and the suffix is used
to end the C statement. The -n, -s and -x options are useful when the binary data represents a bitmap and the output needs to remain read-
able and/or editable. Fonts, for example, are a good example of this.
EXAMPLES
The command:
date | file2c 'const char date[] = {' ',0};'
will produce:
const char date[] = {
83,97,116,32,74,97,110,32,50,56,32,49,54,58,50,56,58,48,53,
32,80,83,84,32,49,57,57,53,10
,0};
BSD
March 22, 2007 BSD