Sponsored Content
Top Forums Shell Programming and Scripting selective replacement of delimiter Post 302620911 by dsravan on Monday 9th of April 2012 01:24:44 PM
Old 04-09-2012
selective replacement of delimiter

I have a file with two fields seperated by comma

data looks like below with the header

Quote:
name,desc
base,180x150, 160x600 and 728x90
gold,160x600,728x90
The o/p should look like this

Quote:
name|desc
base|180x150, 160x600 and 728x90
gold|160x600,728x90
Basically, the req is to replace only the first occuring comma with pipe

can we do this with any commands
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Selective Umask

Hi, We have umask 022 in /etc/profile for security reasons. But I want have some other umask for selected users. how to achieve this? Regards (3 Replies)
Discussion started by: baanprog
3 Replies

2. Shell Programming and Scripting

Replacement of Delimiter

Dear all, i have a proble. in my input file i have records with delimiter like aa-------bb------cc--vghjav---ef----kjd dj--------ih------yy--ujdjkkl---dd----jid now i want to replace the delimiter "-" with "~" i have used a command i.e cat FILENAME | tr "-" "~" >> Newfile this command... (3 Replies)
Discussion started by: panknil
3 Replies

3. Shell Programming and Scripting

Substring based on delimiter, finding last delimiter

Hi, I have a string like ABC.123.XYZ-A1-B2-P1-C4. I want to delimit the string based on "-" and then get result as only two strings. One with string till last hyphen and other with value after last hyphen... For this case, it would be something like first string as "ABC.123.XYZ-A1-B2-P1" and... (6 Replies)
Discussion started by: gupt_ash
6 Replies

4. Shell Programming and Scripting

Conditional replacement of a delimiter

Hello, I'm new to this forum but this seems like the place to ask this question. I have a pipe delimited data file with the fields except for the header being encased in double quotes. I found out that some of the fields have an trash pipe within the data itself. I'd like to conditionally... (4 Replies)
Discussion started by: samahs
4 Replies

5. Shell Programming and Scripting

How to cut by delimiter, and delimiter can be anything except numbers?

Hi all, I have a number of strings like below: //mnt/autocor/43°13'(33")W/ and i'm trying to get the numbers in this string, for example 431333 please help thanks ahead (14 Replies)
Discussion started by: sunnydanniel
14 Replies

6. UNIX for Dummies Questions & Answers

Help with selective ls

Hi all :wall: Can anyone advise how do I use ls to do a selective amd sorted listing of file that I want to have as below? Am looking for files that are named as log_<nnnn>.txt, where <nnnn> are numeric, i.e. I want to have a listing sorted from the newest to the oldest of files that... (7 Replies)
Discussion started by: newbie_01
7 Replies

7. Shell Programming and Scripting

Sed for selective pattern replacement

Hi I am having a code snippet grant permission to all user sts|ln|uSe|PSG sajncht|se|Use|PPSPSG psg|ln|use|TSPSG sts_user.Me revoke I need to change all occurance of use (uSe,Use,use) with USE. I am using the following sed command for this sed 's//USE/g' s_sample.txt Output: (7 Replies)
Discussion started by: sudeep.id
7 Replies

8. UNIX for Dummies Questions & Answers

Selective replace

i have a large sequence of format sat_1_g3_g_0_8540 . A 1 15501 . . . ID=sat_1_g3_g_0_8540;parentName=sat_1_g3_g_0_8540;Al=sat_1_g2_g_0_8540; sat_1_g3_g_2_8510 . C 1 25501 . . . ... (11 Replies)
Discussion started by: siya@
11 Replies

9. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

10. Shell Programming and Scripting

Perl Code to change file delimiter (passed as argument) to bar delimiter

Hi, Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters. Any help would... (2 Replies)
Discussion started by: JPB1977
2 Replies
atReadExpand(3) 					       AtFS Toolkit Library						   atReadExpand(3)

NAME
atOpenExpand, atReadExpand, atCloseExpand - read version objects with attribute citations expanded atGetWriteName - get bound version name of a version object opened with atOpenExpand SYNOPSIS
#include <atfs.h> #include <atfstk.h> int atOpenExpand(char *version, int expand_busy) ; int atReadExpand(int desc, char *bufp, int nbytes) ; void atCloseExpand(int desc) ; char *atGetWriteName(int desc) ; extern int atBindError ; extern char atBindErrorMsg[] ; DESCRIPTION
atOpenExpand, atReadExpand, and atCloseExpand are designed as a nearly plug-compatible replacement for the system calls open(2), read(2), and close(2) for reading of AtFS version objects with attribute citations expanded. atOpenExpand opens the file or AtFS version object version for reading with atReadExpand. Version points to the pathname of a file or AtFS version object. If the flag expand_busy is non-zero, attribute citations are expanded in busy versions also. atOpenExpand returns a descriptor that is valid as argument to successive calls to atReadExpand and atCloseExpand. atReadExpand attempts to read nbytes of data from the object referenced by the descriptor desc into the buffer pointed to by bufp. If desc is zero, atReadExpand reads from the standard input. atReadExpand returns the number of bytes actually read. atCloseExpand frees the resources associated with the descriptor desc. atGetWriteName returns a pointer to the bound version name of the version object for which atOpenExpand returned the descriptor desc. DIAGNOSTICS
On error atOpenExpand and atReadExpand return -1 and set errno appropriately. If one of these returns an error and errno is set to ENOMEM, the application may retry the operation, possibly after freeing some memory. If atOpenExpand returns an error and atBindError has a non-zero value, the string version did not select a version object or not a unique version object. In this case atBindErrorMsg contains an appropriate error message. Possible Values of errno after a call to atOpenExpand: ENOMEM Not enough memory could be allocated. EMFILE All available descriptors are in use. All errno values returned by open(2) or read(2). Possible Values of errno after a call to atReadExpand: ENOMEM Not enough memory could be allocated. EBADF Invalid descriptor. BUGS
Since atOpenExpand reads the complete contents of version into memory, it fails on very large version objects. SEE ALSO
intro(2), open(2), read(2), close(2), errno(3), atattribute(3), atbind(3). AtFStk-1.12 Tue Feb 16 20:33:25 1993 atReadExpand(3)
All times are GMT -4. The time now is 12:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy