Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to replace two or more spaces with one comma? Post 302780599 by ajayram_arya on Thursday 14th of March 2013 06:27:56 PM
Old 03-14-2013
Try this

Code:
bash-3.00$ cat sample.txt|awk '{print $1"\t"$2'}|tr "\t" ","
-5.65,175
-16.17,160
-13.57,270
-51.72,260
-8.30,360
-42.71,460
-.38,375
-.20,375
-4.15,170
-21.53,560
-18.84,360


Last edited by Scrutinizer; 03-15-2013 at 01:08 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace , (comma) with space

Hi, what is the better way to replace the , (comma) with a space char? Example:STRING=dir1,dir2,dir3 toSTRING=dir1 dir2 dir3 And.. how to find if in the string there is a comma? Thanks :) (6 Replies)
Discussion started by: mbarberis
6 Replies

2. Shell Programming and Scripting

replace comma(,) with Tab

hi all, i have a file with commas(,). i want to replace all the commas with tab(\t). Plz help...its urgent... (3 Replies)
Discussion started by: vikas_kesarwani
3 Replies

3. Shell Programming and Scripting

Replace comma with newline

Hi, for some reason I cant seem to figure this out. I have a file which looks something like this word word word word word,word,word word word word,word,word,word,word word word Basically I want this whole thing to be a list with 1 word on each line like this... word word word... (1 Reply)
Discussion started by: eltinator
1 Replies

4. Shell Programming and Scripting

How to Use Sed Command to replace white spaces with comma from between two fields - Mayank

SHELL SCRIPT Hi I have a file in the following format Mayank Sushant Dheeraj Kunal ARUN Samir How can i replace the white space in between and replace them with a comma?? The resultant output should be Mayank,Sushant Dheeraj,Kunal ARUN,Samir i tried using sed -e... (8 Replies)
Discussion started by: mayanksargoch
8 Replies

5. Shell Programming and Scripting

Replace the | with Comma

Hi, The input file structure is given below: The Col1 and Col2 will be there always. But from Col3 there can be more columns. And Col3 will be always Col4 and Col5 will always be with Col6. I need to replace the | with comma. There are scnearios where there wont be no data.Below, the row 2... (6 Replies)
Discussion started by: bharathappriyan
6 Replies

6. Shell Programming and Scripting

Replace newline with comma.

I have output from a file like this: 15,01,11,14:06 235 I would like to change this to: 15,01,11,14:06,235 Removing newline and change to "," I now this can be done with tr cat OUT | tr '\n' ','' My problem is that tr is not implemented in this shell. sed is, show it should be... (7 Replies)
Discussion started by: Jotne
7 Replies

7. UNIX for Dummies Questions & Answers

Need help removing leading spaces from one field in comma seperated file

Using awk or sed, I'd like to remove leading spaces after a comma and before a right justified number in field 6. Sounds simple but I can't find a solution. Each field's formatting must stay intact. Input: 40,123456-02,160,05/24/2012,02/13/1977, 10699.15,0 Output:... (5 Replies)
Discussion started by: Scottie1954
5 Replies

8. Shell Programming and Scripting

How to replace NewLine with comma using sed?

Hi , I have a huge file with following records and I want to replace the last comma with ',NULL'. I try using SED but could not create a correct script . In my opinion I need a script which can convert ,/n with ,NULL/n 1,CHANGE_MEMBER,2010-12-28 00:05:00, 2,CHANGE_MEMBER,2012-09-02... (8 Replies)
Discussion started by: Ajaypal
8 Replies

9. Shell Programming and Scripting

Replace comma and blank with comma and number

I, I have a file and i need to replace comma and blank space with comma and 0. cat file.txt a,5 b,1 c, d, e,4 I need the output as cat file.txt a,5 b,1 c,0 d,0 (4 Replies)
Discussion started by: jaituteja
4 Replies

10. Shell Programming and Scripting

Replace spaces with underscores up to first comma but not after the comma

I have a comma delimited file of major codes and descriptions. I want to replace all occurrences of spaces with underscores up to the first comma (only in the first field), but not replace spaces following the comma. For instance I have the following snippet of the file: EK ED,Elementary and... (7 Replies)
Discussion started by: tdouty
7 Replies
iconv_8859-5(5) 					Standards, Environments, and Macros					   iconv_8859-5(5)

NAME
iconv_8859-5 - code set conversion tables for ISO 8859-5 (Cyrillic) DESCRIPTION
The following code set conversions are supported: +-------------------------------------------------------------------------+ | Code Set Conversions Supported | +--------------+--------+--------------+--------+-------------------------+ | Code |Symbol |Target Code |Symbol | Target Output | +--------------+--------+--------------+--------+-------------------------+ |ISO 8859-5 |iso5 |KOI8-R |koi8 | KOI8-R | +--------------+--------+--------------+--------+-------------------------+ |ISO 8859-5 |iso5 |PC Cyrillic |alt | Alternative PC Cyrillic | +--------------+--------+--------------+--------+-------------------------+ |ISO 8859-5 |iso5 |MS 1251 |win5 | Windows Cyrillic | +--------------+--------+--------------+--------+-------------------------+ |ISO 8859-5 |iso5 |Mac Cyrillic |mac | Macintosh Cyrillic | +--------------+--------+--------------+--------+-------------------------+ CONVERSIONS
The conversions are performed according to the following tables. All values in the tables are given in octal. ISO 8859-5 to KOI8-R For the conversion of ISO 8859-5 to KOI8-R, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | ISO 8859-5 | KOI8-R | ISO 8859-5 | KOI8-R | |24 | 4 |320 |301 | |241 | 263 |321 |302 | |242 | 261 |322 |327 | |243 | 262 |323 |307 | |244 | 264 |324 |304 | |245 | 265 |325 |305 | |246 | 266 |327 |332 | |247 | 267 |330 |311 | |250 | 270 |331 |312 | |251 | 271 |332 |313 | |252 | 272 |333 |314 | |253 | 273 |334 |315 | |254 | 274 |335 |316 | |256 | 276 |336 |317 | |257 | 277 |337 |320 | |260 | 341 |340 |322 | |261 | 342 |341 |323 | |262 | 367 |342 |324 | |263 | 347 |343 |325 | |264 | 344 |344 |306 | |265 | 345 |345 |310 | |266 | 366 |346 |303 | |267 | 372 |347 |336 | |270 | 351 |350 |333 | |271 | 352 |351 |335 | |272 | 353 |352 |337 | |273 | 354 |353 |331 | |274 | 355 |354 |330 | |275 | 356 |355 |334 | |276 | 357 |356 |300 | |277 | 360 |357 |321 | |300 | 362 |360 |260 | |301 | 363 |361 |243 | |302 | 364 |362 |241 | |303 | 365 |363 |242 | |304 | 346 |364 |244 | |305 | 350 |365 |245 | |306 | 343 |366 |246 | |307 | 376 |367 |247 | |310 | 373 |370 |250 | |311 | 375 |371 |251 | |312 | 377 |372 |252 | |313 | 371 |373 |253 | |314 | 370 |374 |254 | |315 | 374 |375 |255 | |316 | 340 |376 |256 | |317 | 361 | | | +---------------+----------------+----------------+---------------+ ISO 8859-5 to PC Cyrillic For the conversion of ISO 8859-5 to PC Cyrillic, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | ISO 8859-5 | PC Cyrillic | ISO 8859-5 | PC Cyrillic | |24 | 4 |307 |227 | |200-240 | 40 |310 |230 | |241 | 360 |311 |231 | |242-254 | 40 |312 |232 | |255 | 260 |313 |233 | |256-257 | 40 |314 |234 | |260 | 200 |315 |235 | |261 | 201 |316 |236 | |262 | 202 |317 |237 | |263 | 203 |320 |240 | |264 | 204 |321 |241 | |265 | 205 |322 |242 | |266 | 206 |323 |243 | |267 | 207 |324 |244 | |270 | 210 |325 |245 | |271 | 211 |326 |246 | |272 | 212 |327 |247 | |273 | 213 |330 |250 | |274 | 214 |331 |251 | |275 | 215 |332 |252 | |276 | 216 |333 |253 | |277 | 217 |334 |254 | |300 | 220 |335 |255 | |301 | 221 |336 |256 | |302 | 222 |337 |257 | |303 | 223 |360-374 |40 | |304 | 224 |375 |260 | |305 | 225 |376 |40 | |306 | 226 |365 |40 | +---------------+----------------+----------------+---------------+ ISO 8859-5 to MS 1251 For the conversion of ISO 8859-5 to MS 1251, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | ISO 8859-5 | MS 1251 | ISO 8859-5 | MS 1251 | |24 | 4 |317 |337 | |200-237 | 40 |320 |340 | |241 | 250 |321 |341 | |242 | 200 |322 |342 | |243 | 201 |323 |343 | |244 | 252 |324 |344 | |245 | 275 |325 |345 | |246 | 262 |326 |346 | |247 | 257 |327 |347 | |250 | 243 |330 |350 | |251 | 212 |331 |351 | |252 | 214 |332 |352 | |253 | 216 |333 |353 | |254 | 215 |334 |354 | |255 | 210 |335 |355 | |256 | 241 |336 |356 | |257 | 217 |337 |357 | |260 | 300 |340 |360 | |261 | 301 |341 |361 | |262 | 302 |342 |362 | |263 | 303 |343 |363 | |264 | 304 |344 |364 | |265 | 305 |345 |365 | |266 | 306 |346 |366 | |267 | 307 |347 |367 | |270 | 310 |350 |370 | |271 | 311 |351 |371 | |272 | 312 |352 |372 | |273 | 313 |353 |373 | |274 | 314 |354 |374 | |275 | 315 |355 |375 | |276 | 316 |356 |376 | |277 | 317 |357 |377 | |300 | 320 |360 |271 | |301 | 321 |361 |270 | |302 | 322 |362 |220 | |303 | 323 |363 |203 | |304 | 324 |364 |272 | |305 | 325 |365 |276 | |306 | 326 |366 |263 | |307 | 327 |367 |277 | |310 | 330 |370 |274 | |311 | 331 |371 |232 | |312 | 332 |372 |234 | |313 | 333 |373 |236 | |314 | 334 |374 |235 | |315 | 335 |375 |210 | |316 | 336 |376 |242 | |376 | 331 | | | +---------------+----------------+----------------+---------------+ ISO 8859-5 to Mac Cyrillic For the conversion of ISO 8859-5 to Mac Cyrillic, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | ISO 8859-5 | Mac Cyrillic | ISO 8859-5 | Mac Cyrillic | |24 | 4 |317 |237 | |200-237 | 40 |320 |340 | |240 | 312 |321 |341 | |241 | 335 |322 |342 | |242 | 253 |323 |343 | |243 | 256 |324 |344 | |244 | 270 |325 |345 | |245 | 301 |326 |346 | |246 | 247 |327 |347 | |247 | 272 |330 |350 | |250 | 267 |331 |351 | |251 | 274 |332 |352 | |252 | 276 |333 |353 | |253 | 40 |334 |354 | |254 | 315 |335 |355 | |255 | 40 |336 |356 | |256 | 330 |337 |357 | |257 | 332 |340 |360 | |260 | 200 |341 |361 | |261 | 201 |342 |362 | |262 | 202 |343 |363 | |263 | 203 |344 |364 | |264 | 204 |345 |365 | |265 | 205 |346 |366 | |266 | 206 |347 |367 | |267 | 207 |350 |370 | |270 | 210 |351 |371 | |271 | 211 |352 |372 | |272 | 212 |353 |373 | |273 | 213 |354 |374 | |274 | 214 |355 |375 | |275 | 215 |356 |376 | |276 | 216 |357 |337 | |277 | 217 |360 |334 | |300 | 220 |361 |336 | |301 | 221 |362 |254 | |302 | 222 |363 |257 | |303 | 223 |364 |271 | |304 | 224 |365 |317 | |305 | 225 |366 |264 | |306 | 226 |367 |273 | |307 | 227 |370 |300 | |310 | 230 |371 |275 | |311 | 231 |372 |277 | |312 | 232 |373 |40 | |313 | 233 |374 |316 | |314 | 234 |375 |40 | |315 | 235 |376 |331 | |316 | 236 | | | +---------------+----------------+----------------+---------------+ FILES
/usr/lib/iconv/*.so conversion modules /usr/lib/iconv/*.t conversion tables /usr/lib/iconv/iconv_data list of conversions supported by conversion tables SEE ALSO
iconv(1), iconv(3C), iconv(5) SunOS 5.10 18 Apr 1997 iconv_8859-5(5)
All times are GMT -4. The time now is 09:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy