Sponsored Content
Top Forums Shell Programming and Scripting Editing Commas in a textfile using sed Post 302352063 by repinementer on Thursday 10th of September 2009 09:56:09 AM
Old 09-10-2009
Thanx for effort even though its ugly
What if the it not just about 5th and 6th columns. If they happen to appear in 7th and 8th columns is the same code applies?

---------- Post updated at 05:56 AM ---------- Previous update was at 05:53 AM ----------

I think its working perfect. If you explain the code that really helpful to me and others so that we could play with the script for other requirements.
Thanx
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Editing File using awk/sed

Hello Awk Gurus, Can anyone of you help me with the below problem. I have got a file having data in below format pmFaultyTransportBlocks ----------------------- 9842993 pmFrmNoOfDiscRachFrames ----------------------- NULL pmNoRecRandomAccSuccess -----------------------... (4 Replies)
Discussion started by: Mohammed
4 Replies

2. 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

3. Homework & Coursework Questions

String editing using sed? awk?

1. The problem statement, all variables and given/known data: Problem Statement for project: When an account is created on the CS Unix network, a public html directory is created in the account's home directory. A default web page is put into that directory. Some users replace or... (13 Replies)
Discussion started by: peage1475
13 Replies

4. Shell Programming and Scripting

Help with sed and replacing white spaces with commas

Dear all, I am in a bit of a quandary. I have 400 text files which I need to edit and output in a very specific way. Here is a sample text file copied from gedit ... The columns will come out a bit messed up but when I cat <file>, it gives a table with six columns (0-28, tot lob vol, vcsf,... (6 Replies)
Discussion started by: antonz
6 Replies

5. Shell Programming and Scripting

sed or awk editing help

Hi all I use aix (sadly). I've got a file consisting of fields separated by commas, I need a sed or awk command that will delete all spaces between two commas as long as there are only spaces between the commas. eg ,abc, ,sd , ,dr at would become ,abc,,sd ,,dr at I have... (53 Replies)
Discussion started by: mychmose
53 Replies

6. UNIX for Dummies Questions & Answers

sed editing help....

Hello all, I need some help with sed. seems like i cant get through it. So here is what i am trying. when i do ps -ef|grep bla blah ...like below...i get /u01/app/oracle/11g/bin/tnslsnr .... but i want to replace that string with something using sed. So basically i want to get rid of... (3 Replies)
Discussion started by: abdul.irfan2
3 Replies

7. Windows & DOS: Issues & Discussions

Extracting variables between commas : GAWK or SED

Hello, I need some help, I got a CSV file called test.txt with this text in it : 08/02/2011;0,677;0,903;1,079;1,336;1,513;1,683 There's only a line and i need to copy theese numbers into variables : 0,677 0,903 1,079 1,336 1,513 1,683 The output file should look like this... (5 Replies)
Discussion started by: jujulips
5 Replies

8. UNIX for Dummies Questions & Answers

sed help finding and editing

With sed 1. I need to find a line that contains "DVM" and "73069". 2. I need to insert a double quote at the beginning of the first line of the file. These two have been driving me crazy for the last 45 minutes. Any help would be greatly appreciated. Thanks (3 Replies)
Discussion started by: nlassiter
3 Replies

9. Shell Programming and Scripting

HELP with AWK or SED. Need to replace the commas between double quotes in CSV file

Hello experts, I need to validate a csv file which contains data like this: Sample.csv "ABCD","I",23,0,9,,"23/12/2012","OK","Street,State, 91135",0 "ABCD","I",23,0,9,,"23/12/2012","OK","Street,State, 91135",0 I just need to check if all the records contain exactly the number of... (5 Replies)
Discussion started by: shell_boy23
5 Replies

10. Shell Programming and Scripting

How to separate sorte different characters from one textfile and copy them in a new textfile?

My first post, so don't kill me :) Say i open some textfile with some example like this. on the table are handy, bread and wine Now i know exactly what is in and i want to separate and sorted it in terminal to an existing file with another 2 existing lines in like this: table plane ... (3 Replies)
Discussion started by: schwatter
3 Replies
ldapscripts(5)							File Formats Manual						    ldapscripts(5)

NAME
ldapscripts - Scripts to manage POSIX accounts in your LDAP directory. DESCRIPTION
The ldapscripts are a set of shell (sh) scripts designed to manage POSIX accounts in an OpenLDAP directory. They can be used as standalone tools or within Samba 3.x's smb.conf file. REQUIREMENTS
The main requirements are the OpenLDAP client tools (ldapadd, ldapsearch, ldapdelete, ...). Other commands are called in the scripts but should come with your OS (sed, grep, cut, ...). CONFIGURATION
The main configuration of the ldapscripts is usually the file /etc/ldapscripts/ldapscripts.conf (or /usr/local/etc/ldapscripts/ldap- scripts.conf, depending on your system). Modify it to fit your needs before using the scripts. Each script also uses a "runtime" file, usu- ally /usr/lib/ldapscripts/runtime (or /usr/local/lib/ldapscripts/runtime). You don't need to modify this file. TEMPLATES
Each script that adds information to the directory uses a template. Templates are directly embedded at the end of the scripts but it is also possible to use external template files (see GTEMPLATE, UTEMPLATE and MTEMPLATE variables in the configuration file). Each template consists of a preformatted LDIF file using special keywords that will be replaced on-the-fly. Sample files are provided for your conve- nience : ldapaddgroup.template.sample, ldapadduser.template.sample and ldapaddmachine.template.sample. It is strongly advised to use those files instead of modifying the embedded (default) templates in the scripts. Sample templates include every keyword you can use. One special additional keyword is the <ask> keyword that will trigger user input to get the attribute value interactively. USING AS STANDALONE TOOLS
Each script can be used as a standard command-line tool. Check their man pages to get help. USING WITH SAMBA 3.x Each Samba 3.x smb.conf "xxx script" option has a matching script. Modify you smb.conf file this way to call them : # [...] add machine script = /usr/local/sbin/ldapaddmachine '%u' sambamachines add user script = /usr/local/sbin/ldapadduser '%u' sambausers add group script = /usr/local/sbin/ldapaddgroup '%g' add user to group script = /usr/local/sbin/ldapaddusertogroup '%u' '%g' delete user script = /usr/local/sbin/ldapdeleteuser '%u' delete group script = /usr/local/sbin/ldapdeletegroup '%g' delete user from group script = /usr/local/sbin/ldapdeleteuserfromgroup '%u' '%g' set primary group script = /usr/local/sbin/ldapsetprimarygroup '%u' '%g' rename user script = /usr/local/sbin/ldaprenameuser '%uold' '%unew' # [...] SEE ALSO
ldapdeletemachine(1), ldapmodifymachine(1), ldaprenamemachine(1), ldapadduser(1), ldapdeleteuserfromgroup(1), ldapfinger(1), ldapid(1), ldapmodifyuser(1), lsldap(1), ldapaddusertogroup(1), ldaprenameuser(1), ldapinit(1), ldapsetpasswd(1), ldapaddgroup(1), ldapdeletegroup(1), ldapsetprimarygroup(1), ldapmodifygroup(1), ldaprenamegroup(1), ldapaddmachine(1), ldapdeleteuser(1). AVAILABILITY
The ldapscripts are provided under the GNU General Public License v2 (see COPYING for more details). The latest version of the ldapscripts is available on : http://contribs.martymac.org BUGS
Sometimes, that kind of message may appear in the log file : Additional information: value does not conform to assertion syntax . Setting slapd's debug level to 32 shows additional details : get_ava: illegal value for attributeType uidNumber . This is *not* a bug : the ldap- scripts tend to use the power of LDAP filters to easily find users (or groups) using either a uidNumber (numerical value) or a uid (string value). The following filter (used by ldapfinger(1)) will generate the above message if $_USER is a login : "(|(&(objectClass=posixAc- count)(|(uid=$_USER)(uidNumber=$_USER))) (&(objectClass=posixGroup)(|(cn=$_USER)(gidNumber=$_USER))))" because filter part "(uidNum- ber=$_USER)" requires an integer but gets a string. You can mostly ignore those warnings. January 1, 2006 ldapscripts(5)
All times are GMT -4. The time now is 02:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy