Sponsored Content
Full Discussion: Insert commas
Top Forums UNIX for Beginners Questions & Answers Insert commas Post 302983244 by loktamann on Saturday 8th of October 2016 04:13:17 PM
Old 10-08-2016
Insert commas

Code:
Original content:
ACACCTCAT    129                                              | ACACCTCAT    0
ACACCTCATX   171                                              | ACACCTCATX   0
ACACRESRT    0                                                  ACACRESRT    0
ACACRESRTX   0                                                  ACACRESRTX   0
ACACTCOPY    0                                                  ACACTCOPY    0
ACACTGRP     12                                               | ACACTGRP     0
ACACTIVITY   82                                               | ACACTGRPAU   0
ACACTMXVAL   145                                              | ACACTIVITY   0
                                                              > ACACTMXVAL   0
ACACTMXVDT   0                                                  ACACTMXVDT   0
ACACTREL     0                                                  ACACTREL     0
ACACTSEG     0                                                  ACACTSEG     0
ACADDASSGN   0                                                  ACADDASSGN   0
ACADDLCNTR   4                                                | ACADDLCNTR   0
UKCOTABLE    648                                              <
UKNICAT      37                                               <


Result:
ACACCTCAT,    129,                                              | ACACCTCAT,    0
ACACCTCAT,   171,                                              | ACACCTCATX,   0
ACACRESRT,    0,                                                  ACACRESRT,    0
ACACRESRTX,   0,                                                  ACACRESRTX,   0
ACACTCOPY,    0,                                                  ACACTCOPY,    0
ACACTGRP,     12,                                               | ACACTGRP,     0
ACACTIVITY,   82,                                               | ACACTGRPAU,   0
ACACTMXVAL,   145,                                              | ACACTIVITY,   0
                    ,      ,                                    > ACACTMXVAL,   0
ACACTMXVDT,   0,                                                  ACACTMXVDT,   0
ACACTREL,     0,                                                  ACACTREL,     0
ACACTSEG,     0,                                                  ACACTSEG,     0
ACADDASSGN,   0,                                                  ACADDASSGN,   0
ACADDLCNTR,   4,                                                | ACADDLCNTR,   0
UKCOTABLE,    648,                                              <,
UKNICAT,      37,                                               <,

I know a little bit of sed and awk. If you guru can show me either one of the commands, greatly appreciated. I appreciate any help you can provide.
I tried
Code:
sed 's/............./&,/g'

and it insert comma (,) at every 14th position.

Last edited by Scrutinizer; 10-08-2016 at 06:29 PM.. Reason: Changed position of [/code]
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I insert commas/delimiters in File

Hi, Newbie here. Need to convert a txt file to .csv format. There's no character to replace so not sure if I can use sed :confused: . The comma is to be inserted after every certain number of characters in each line... Help! Thanks. (4 Replies)
Discussion started by: mbelen
4 Replies

2. Shell Programming and Scripting

formatted output with commas

var=12345 echo $var >>>12345 printf "%8.1f \n" $var >>> 12345.0 How to get this as 12,345? I suppose I could break into sections by dividing by 1000 or 1000000. But, is the a trick to this? (4 Replies)
Discussion started by: joeyg
4 Replies

3. Shell Programming and Scripting

substitute commas with pipe

Hi All, I have a file that contain value below: test,mno,mno, +asc mno,lok,msyu,tts test,poi,test,0,90, 3,00 i need to substitute the comma's into pipe where i... (2 Replies)
Discussion started by: selamba_warrior
2 Replies

4. UNIX for Dummies Questions & Answers

Inserting commas and replacing backslashes with commas

Hi, Newbie here. I have a file that consists of data that I want to convert to a csv file. For example: Jul 20 2008 1111 / visit home / BlackBerry8830/4.2.2 Profile/MIDP-2.0 Configuration/CLOC-1.1 VendorID/105 Jul 21 2008 22222 / add friend / BlackBerry8830/4.2.2 Profile/MIDP-2.0... (3 Replies)
Discussion started by: kangaroo
3 Replies

5. Shell Programming and Scripting

Need help in removing commas

i have the below line as output from a script. I want to delete the string "," and get the output without comma, cat D* | grep "bytes free" | awk '{print $3}' | ????? output: 40,966,189,056 Desired O/P: 40966189056 (1 Reply)
Discussion started by: ali560045
1 Replies

6. UNIX for Dummies Questions & Answers

Insert Commas at fixed positions

Hi I have a text file which is position delimited, i.e. Code1 Description1 Value1 Code2 Description2 Value2 etc. I want to import this file into MySQL so I want to convert the file into Comma delimited format. To do this I want to insert commas at fixed positions on... (7 Replies)
Discussion started by: arossco
7 Replies

7. Shell Programming and Scripting

Commas within Delimeters

Hi experts, I would like a favour from you guys to get the info from 5th column which was separated by the delimeter comma ( , ) The Data file is as below:- 1,USER1,"90, TEST AVENUE, OLD ROAD",test1,124,N 2,USER2,88 TEST STREET NEW ROAD,test2,123,N The User File is as below:- USER1... (1 Reply)
Discussion started by: shenkz
1 Replies

8. Shell Programming and Scripting

Replace field with commas with field without commas

Hey guys, I have the following text: 1,2,3,4,5,6,'NULL','when',NULL,1,2,0,'NULL' 1,2,3,4,5,6,'NULL','what','NULL',1,2,0,1 I need the same text with the word NULL without commas u know something like this: 1,2,3,4,5,6,NULL,'when',NULL,1,2,0,NULL 1,2,3,4,5,6,NULL,'what','NULL',1,2,0,1 ... (1 Reply)
Discussion started by: lmyk72
1 Replies

9. Shell Programming and Scripting

Insert Inverted Commas Around Numeric Values

Hi, I am trying to insert Inverted Commas around all the numeric values within a comma seperated string / variable. 1111,2222,3333,4444 I would like it to be: '1111','2222','3333','4444' Note - This string could have a differing amount of numeric values each time the variable is... (4 Replies)
Discussion started by: RichZR
4 Replies

10. UNIX for Dummies Questions & Answers

Insert single quote and commas

Hi All, I have a set of data as below : XS012371378 Raj 23-09-12 SH128238948 Andrew 24-08-12 CH273712399 Walsh 12-10-12 JK7249923893 Nick 10-02-13 JP6383791389 Braslin 30-12-13 I want the first column to be extracted separately. I can get this using awk. awk '{print $1}' file_name ... (3 Replies)
Discussion started by: Nand Kishor
3 Replies
ftpservers(4)							   File Formats 						     ftpservers(4)

NAME
ftpservers - FTP Server virtual hosting configuration file SYNOPSIS
/etc/ftpd/ftpservers DESCRIPTION
The ftpservers file is used to configure complete virtual hosting. In contrast to limited virtual hosting, complete virtual hosting allows separate configuration files to be specified for each virtual host. The set of configuration files for each virtual host are placed in their own directory. The ftpservers file associates the address of each virtual host with the directory its configuration files are stored in. The virtual host configuration files must be named: ftpaccess Virtual host's access file ftpusers Restricts the accounts that can use the virtual host ftpgroups Virtual hosts enhanced group access file ftphosts Allow or deny usernames access to the virtual host ftpconversions Customize conversions available from the virtual host You do not need to put every file in each virtual host directory. If you want a virtual host to use the master copy of a file, then do not include it in the virtual host directory. If the file is not included, the master copy from the /etc/ftpd directory will be used. The file names must match exactly. If you misspell any of them or name them differently, the server will not find them, and the server will use the master copy instead. The ftpaddhost utility is an administrative tool to configure virtual hosts. See ftpaddhost(1M). File Format There are two fields to each entry in the ftpservers file: address directory-containing-configuration-files For example: 10.196.145.10 /etc/ftpd/virtual-ftpd/10.196.145.10 10.196.145.200 /etc/ftpd//virtual-ftpd/10.196.145.200 some.domain INTERNAL When an FTP client connects to the FTP Server, in.ftpd(1M) tries to match the IP address to which the FTP client connected with one found in the ftpservers file. The address can be an IPv4 or IPv6 address, or a hostname. If a match is found, The FTP server uses any configuration files found in the associated directory. If a match is not found, or an invalid directory path is encountered, the default paths to the configuration files are used. The use of INTERNAL in the example above fails the check for a specific directory, and the master configuration files will be used. Either the actual IP address or a specific hostname can be used to specify the virtual host. It is better to specify the actual IP of the virtual host, as it reduces the need for a domain lookup and eliminates DNS security related naming issues, for example: 10.196.145.20 /etc/ftpd/config/faqs.org/ ftp.some.domain /etc/ftpd/config/faqs.org/ Lines that begin with a # sign are treated as comment lines and are ignored. FILES
/etc/ftpd/ftpservers ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWftpr | +-----------------------------+-----------------------------+ |Interface Stability |External | +-----------------------------+-----------------------------+ SEE ALSO
ftpaddhost(1M), in.ftpd(1M), ftpaccess(4), ftpconversions(4), ftpgroups(4), ftphosts(4), ftpusers(4), attributes(5) SunOS 5.11 1 May 2003 ftpservers(4)
All times are GMT -4. The time now is 01:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy