Sponsored Content
Top Forums Shell Programming and Scripting Converting csv file to flat file Post 303023614 by Don Cragun on Thursday 20th of September 2018 03:54:22 AM
Old 09-20-2018
Quote:
Originally Posted by rohit_shinez
Basically the text file have fixed length like country - 1-20,id 21-25,role - 26-30.
Country - will accept only 20 characters
id - 5 characters
role - 5 characters
Great. I can't wait to see what you come up with to meet these requirements. How you will fit 12399999 into a 5 character id field and how you will fit engineer and doctor into a 5 character role field is beyond me. Please explain how you determined that two fields need to be 5 characters wide when they need to hold values that contain more than 5 characters.

And, of course, you still haven't specified justification for values that don't completely fill a field???

Please show us the code you've come up with to meet these requirements!
These 2 Users Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting Pivot file to flat file

I have a file in this format. P1 P2 P3......................... A001 v11 v21 v31...................... A002 v12 v22 v32............................ A003 v13 v23 v33.......................... A004 v14 v24 v34.............................. . . . A00n... (2 Replies)
Discussion started by: vskr72
2 Replies

2. Shell Programming and Scripting

Awk to convert a flat file to CSV file

Hi , I have a file with contents as below: Contract Cancellation Report UARCNCL LOS CODE DATE REAS TYPE AMOUNT AMOUNT LETTER BY ========= ======= ==== ==== ==== ========= ==== ==== 8174739 7641509 1S NONE CRCD 30-JUN-2008 NPAR N .00 .00 CCAN 8678696 8091709 1S NONE DDEB 30-JUN-2008... (14 Replies)
Discussion started by: rkumudha
14 Replies

3. Shell Programming and Scripting

Converting Column to Rows in a Flat file

Hi, Request To guide me in writing a shell program for the following requirement: Example:if the Input File contains the follwing data Input File Data: 80723240029,12,323,443,88,98,7,98,67,87 80723240030,12,56,6,,,3,12,56,6,7,2,3,12,56,6,7,2,3,88,98,7,98,67,87... (5 Replies)
Discussion started by: srinikal
5 Replies

4. UNIX for Advanced & Expert Users

Problem in converting password protected excel file to csv file in unix

I need to convert a password protected excel file which will be in UNIX server to a comma separated file. For this I need to open the excel file in UNIX box but the UNIX box doesn't prompt for password instead it is opened in an encrypted manner. I could manually ftp the excel file to local... (2 Replies)
Discussion started by: Devivish
2 Replies

5. UNIX for Advanced & Expert Users

Converting .csv file into .xls file and send it to inbox

Hi All, I wrote a script to extract data from Oracle DB and place it in a text file , and I have coverted .txt file into comma seperated .csv file and I sent it to my mail box . I can get .xls file in my inbox.I am getting all data in same column and in different rows , without column... (1 Reply)
Discussion started by: krthkmuthu
1 Replies

6. UNIX for Dummies Questions & Answers

cleaning up spaces from fixed width file while converting to csv file

Open to a sed/awk/or perl alternative so that i can stick command into my bash script. This is a problem I resolve using a combination of cut commands - but that is getting convoluted. So would really appreciate it if someone could provide a better solution which basically replaces all... (3 Replies)
Discussion started by: svn
3 Replies

7. Shell Programming and Scripting

Converting a flat file in XML

Hello Friends, I am new to UNIX shell scripting. Using bash....Could you please help me in converting a flat file into an XML style output file. Flat file: (Input File entries looks like this) John Miller: 617-569-7996:15 Bunting lane, staten Island, NY: 10/21/79: 60600 The... (4 Replies)
Discussion started by: humkhn
4 Replies

8. UNIX for Advanced & Expert Users

Converting the date format in a flat file

Hi All, I am new to this forum, could any one help me out in resolving the below issue. Input of the flat file contains several lines of text for example find below: 5022090,2,4,7154,88,,,,,4/1/2011 0:00,Z,L,2 5022090,3,1,6648,88,,,,,4/1/2011 0:00,Z,,1... (0 Replies)
Discussion started by: av_sagar
0 Replies

9. Shell Programming and Scripting

Help with converting XML to Flat file

Hi Friends, I want to convert a XML file to flat file. Sample I/p: <?xml version='1.0' encoding='UTF-8' ?> <DataFile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' contactCount='4999' date='2012-04-14' time='22:00:14' xsi:noNamespaceSchemaLocation='gen .xsd'> <Contact... (3 Replies)
Discussion started by: karumudi7
3 Replies

10. Shell Programming and Scripting

reading a csv file and creating a flat file

hi i have written a script for reading a csv file and creating a flat file, suggest if this script can be optimized #---------------- FILENAME="$1" SCRIPT=$(basename $0) #-----------------------------------------// function usage { echo "\nUSAGE: $THIS_SCRIPT file_to_process\n"... (3 Replies)
Discussion started by: mprakasheee
3 Replies
rolemod(1M)						  System Administration Commands					       rolemod(1M)

NAME
rolemod - modify a role's login information on the system SYNOPSIS
rolemod [ -u uid [-o]] [-g group] [ -G group [ , group...]] [ -d dir [-m]] [-s shell] [-c comment] [-l new_name] [-f inactive] [-e expire] [-A authorization [, authorization]] [-P profile [, profile]] [-K key=value] role DESCRIPTION
The rolemod utility modifies a role's login information on the system. It changes the definition of the specified login and makes the appropriate login-related system file and file system changes. The system file entries created with this command have a limit of 512 characters per line. Specifying long arguments to several options may exceed this limit. OPTIONS
The following options are supported: -A authorization One or more comma separated authorizations as deined in auth_attr(4). Only role with grant rights to the autho- rization can assign it to an account. This replaces any existing authorization setting. If no authorization list is specified, the existing setting is removed. -c comment Specify a comment string. comment can be any text string. It is generally a short description of the login, and is currently used as the field for the user's full name. This information is stored in the user's /etc/passwd entry. -d dir Specify the new home directory of the role. It defaults to base_dir/login, where base_dir is the base directory for new login home directories, and login is the new login. -e expire Specify the expiration date for a role. After this date, no role will be able to access this login. The expire option argument is a date entered using one of the date formats included in the template file /etc/datemsk. See getdate(3C). For example, you may enter 10/6/90 or October 6, 1990. A value of `` '' defeats the status of the expired date. -f inactive Specify the maximum number of days allowed between uses of a login ID before that login ID is declared invalid. Normal values are positive integers. A value of 0 defeats the status. -g group Specify an existing group's integer ID or character-string name. It redefines the role's primary group membership. -G group Specify an existing group's integer "ID" "," or character string name. It redefines the role's supplementary group membership. Duplicates between group with the -g and -G options are ignored. No more than NGROUPS_UMAX groups may be specified as defined in <param.h>. -K key=value Replace existing or add to a role's key=value pair attributes. Multiple -K options may be used to replace or add multiple key=value pairs. The generic -K option with the appropriate key may be used instead of the specific implied key options (-A and -P). See user_attr(4) for a list of valid key=value pairs. Keys may not be repeated. Specifying a key= without a value removes an existing key=value pair. The "type" key may only be specified without a value or with the "normal" value for this option. Specifying the "type" key without a value leaves the account as a normal user, with the "role" value changing from a role user to a normal user. -l new_logname Specify the new login name for the role. The new_logname argument is a string no more than eight bytes consisting of characters from the set of alphabetic characters, numeric characters, period (.), underline (_), and hypen (-). The first character should be alphabetic and the field should contain at least one lower case alphabetic character. A warning message will be written if these restrictions are not met. A future Solaris release may refuse to accept login fields that do not meet these requirements. The new_logname argument must contain at least one character and must not contain a colon (:) or NEWLINE ( ). -m Move the role's home directory to the new directory specified with the -d option. If the directory already exists, it must have permissions read/write/execute by group, where group is the role's primary group. -o This option allows the specified UID to be duplicated (non-unique). -P profile One or more comma-separated execution profiles defined in auth_attr(4). This replaces any existing profile set- ting. If no profile list is specified, the existing setting is removed. -s shell Specify the full pathname of the program that is used as the role's shell on login. The value of shell must be a valid executable file. -u uid Specify a new UID for the role. It must be a non-negative decimal integer less than MAXUID as defined in <param.h>. The UID associated with the role's home directory is not modified with this option; a role will not have access to their home directory until the UID is manually reassigned using chown(1). OPERANDS
The following operands are supported: login An existing login name to be modified. EXIT STATUS
In case of an error, rolemod prints an error message and exits with one of the following values: 2 The command syntax was invalid. A usage message for the rolemod command is displayed. 3 An invalid argument was provided to an option. 4 The uid given with the -u option is already in use. 5 The password files contain an error. pwconv(1M) can be used to correct possible errors. See passwd(4). 6 The login to be modified does not exist, the group does not exist, or the login shell does not exist. 8 The login to be modified is in use. 9 The new_logname is already in use. 10 Cannot update the /etc/group or /etc/user_attr file. Other update requests will be implemented. 11 Insufficient space to move the home directory (-m option). Other update requests will be implemented. 12 Unable to complete the move of the home directory to the new home directory. FILES
/etc/group system file containing group definitions /etc/datemsk system file of date formats /etc/passwd system password file /etc/shadow system file containing users' and roles' encrypted passwords and related information /etc/usr_attr system file containing additional user and role attributes ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
chown(1), passwd(1), users(1B), groupadd(1M), groupdel(1M), groupmod(1M), logins(1M), pwconv(1M), roleadd(1M), roledel(1M), useradd(1M), userdel(1M), usermod(1M), getdate(3C), auth_attr(4), passwd(4), attributes(5) SunOS 5.10 1 Jul 2004 rolemod(1M)
All times are GMT -4. The time now is 02:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy