07-24-2009
Error while appending records to a file
Hi,
I have a sample file which contains records.
Input File :
1 user1 username1\password@database-name
2 user2 username2\password@database-name
3 user3 username1\password@database-name
I should search for a 'username1\' in those records. If 'username1\' is found in those records, that record should be appended to a new file.
output file :
1 user1 username1\password@database-name
3 user3 username1\password@database-name
For the above requirement I have written a script as below.
#!/bin/ksh
set -x
cd directory
for file in `cat filename`
do
if [ -f *username1\* ]
then
$file >> outputfile
else
continue
fi
done
set +x
But when I execute the script it is not appeneding the records to output file. Please help me regarding this.
Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a flat file and need to count no of records in the file less the header and the trailer record.
I would appreciate any and all asistance
Thanks
Hadi Lalani (2 Replies)
Discussion started by: guiguy
2 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
I just want to append the value in variable at the end of the file.
var=1234
sed -e "$a $var" file1 > file 2.
But I get this error
sed: -e expression #1, char 4: unknown command: `1'
Kindly let m know how can I do that... (5 Replies)
Discussion started by: waqar1
5 Replies
3. Shell Programming and Scripting
Hi Everyone,
I have an issue and trying to get a solution but was not succesful yet. Any help is greatly appreciated.
I am using ksh to inoke sql loader to load data from txt file into two oracle tables based on the condition written in the control file. If an error occurs while loading into... (8 Replies)
Discussion started by: vpv0002
8 Replies
4. UNIX for Dummies Questions & Answers
Hi everyone.
I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this:
ID: 20
Name: X
Age: 19
ID: 21
Name: Z
ID: 22
Email: xxx@yahoo.com
Name: Y
Age: 19
I want to grep records that... (4 Replies)
Discussion started by: Atrisa
4 Replies
5. Shell Programming and Scripting
HI,
I have a source file which has the below data.
Tableid,table.txt
sourceid,1,2,3,4,5,6
targetid,1,2,3,4,5,6
Tableid,table
sourceid,1,2,3,4,5,6
targetid,1,2,3,4,5,6
Tableid,table.txt
sourceid,1,2,3,4,5,6
targetid,1,2,3,4,5,6
Tableid,table
sourceid,1,2,3,4,5,6
targetid,1,2,3,4,5,6... (6 Replies)
Discussion started by: shruthidwh
6 Replies
6. Shell Programming and Scripting
Hello,
For the input file, I am trying to split those records which have multiple values seperated by '|' in the last input field, into multiple records and each record corresponds to the common input fields + one of the value from the last field.
I was trying with an example on this forum... (4 Replies)
Discussion started by: imtiaz99
4 Replies
7. Shell Programming and Scripting
I have 2 files
"File 1" is delimited by ";" and "File 2" is delimited by "|".
File 1 below (3 record shown):
Doc1;03/01/2012;New York;6 Main Street;Mr. Smith 1;Mr. Jones
Doc2;03/01/2012;Syracuse;876 Broadway;John Davis;Barbara Lull
Doc3;03/01/2012;Buffalo;779 Old Windy Road;Charles... (2 Replies)
Discussion started by: vestport
2 Replies
8. Shell Programming and Scripting
I am relatively new to this forum and Unix scripting.
ksh script:
part 1 :will call a PL\SQL program will create 3 CSV file at the unix directory.
part 2 : will sftp the files to the EFT server.
Once the EFT server receives these file , it will transfer them to a shared windows folders.
... (3 Replies)
Discussion started by: developerpa
3 Replies
9. Shell Programming and Scripting
Hi,
I look for a awk one liner for below issue.
input file
ABC 1234 abc 12345
ABC 4567 678 XYZ
xyz ght 678
ABC 787 yyuu
ABC 789 7890 777
zxr hyip hyu
mno uii 678 776
ABC ty7 888
All lines should be started with ABC as first field. If a record has another value for 1st... (7 Replies)
Discussion started by: ratheesh2011
7 Replies
10. Shell Programming and Scripting
Hi I am new to shell programming in unix
Please if I can provide help.
I have a file structure of a header record and "N" detail records.
The header record will be the total number of detail records
I need to split the file in 2:
One for the header
Another for all detail records
Could... (1 Reply)
Discussion started by: jamcogar
1 Replies
auth(5) File Formats Manual auth(5)
Name
auth - auth database
Description
The database is a repository of security-relevant information about each user of the system. This database contains the encrypted password
associated with the user's account in addition to a list of assorted capabilities. The database is stored as an database in the files and
Records are retrieved with the library routine. Access to the database is restricted to the superuser and members of the group
Auth records may be converted to an ASCII representation whose format is:
1000:4KvidFYwovnwp3j8lll78dC1:1920129:3600:2678400:03:0:1000:0:00:00
The first field is the UID of the entry that is used as the key into the database. Then follows:
Encrypted Password
This is the user's encrypted password. Whether this password or the one from the file is actually used is determined by the
security level that the system is running at.
Password Modification Time
This is the time(2) the password was last set.
Minimum Password Lifetime
This is the minimum number of seconds which must elapse between setting passwords.
Maximum Password Lifetime
This is the maximum period of time for which the password will be valid.
Account Mask These are capabilities pertaining to the account itself. They are:
1 A_ENABLE: this account is enabled.
2 A_CHANGE_PASSWORD: The user can change his or her password.
4 A_ENTER_PASSWORD: The user is not required to use machine-generated passwords.
Login Failure Count
This is the count of unsuccessful login attempts since the last successful login.
Audit ID Positive integer identifier used in generating audit records for the user.
Audit Control See the reference page, SET_APROC_CNTL section for more information.
Audit Mask Determines which events will be audited for the user. See the and reference pages for more information.
Restrictions
Only the superuser and members of the group may read information from the auth database. Only the superuser may modify the auth database.
Files
See Also
audcntl(2), getauthuid(3), getpwent(3), edauth(8)
auth(5)