Sponsored Content
Top Forums Shell Programming and Scripting how to add extra a field in a flat txt file ? Post 302512187 by britney on Friday 8th of April 2011 02:59:04 PM
Old 04-08-2011
how to add extra a field in a flat txt file ?

Hi all,

I did not use UNIX for a long time, now i need to make a flat file with extra field, can you help me with the code ?
1. I create a last line of each log from each system and make it in a flat text file (seperate by a pipe |)
mv current.log old
tail -1 sanfrancisco.log > current.log
tail -1 oakland.log >> current.log

Current.log
Code:
2011/04/07 14:49:46 |   61:linux   pid=027546 opened Boards 0, 1, 2, 3 for /home/goniners/abcd/
2011/04/08 08:13:39 |  255:linux   pid=016870 opened Boards 0, 1, 2, 3, 4, 6 for /home/gosteelers/asdas/

2. How do we create new.log which have a hostname in a 2nd fields ?
Code:
2011/04/07 14:49:46 |sanfrancisco|   61:linux   pid=027546 opened Boards 0, 1, 2, 3 for /home/goniners/abcd/
2011/04/08 08:13:39 |oakland|  255:linux   pid=016870 opened Boards 0, 1, 2, 3, 4, 6 for /home/gosteelers/asdas/

Thanks,
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reindex or re-increment last field of txt file.

I am using a database text file with a field that increments +1 with each new entry, occasionally if a entry is deleted the unique sequence is disrupted. I am looking for a small script/function in sh and/or perl that would re index this. Example of db file: Name | Address | misc |number... (2 Replies)
Discussion started by: silenthands
2 Replies

2. Shell Programming and Scripting

`find`, pulling 1st field from ASCII flat file as search/-name?

Hey Everyone! I have searched around for this on Unix.com and Google, and I'm either not phrasing my search properly or this is not as simple as I thought... I have a script that runs on a nightly basis that pulls one field worth of data from an internal MySQL database and populates to an... (2 Replies)
Discussion started by: Gecko12332
2 Replies

3. Shell Programming and Scripting

gawk help for inserting a field of a .txt file in the same file

i had the following type of data file vchrdump: Vouchers For Date :05/01/2009 * ... (4 Replies)
Discussion started by: KANNI786
4 Replies

4. UNIX for Advanced & Expert Users

Find and replace txt between two strings in flat file

Hi There... I need to serach and replace strngs in a text file. My file has; books.amazon='Let me read' news.bestseller='xyz' expected output is books.amazon=NONFOUND news.bestseller=NONFOUND Can I first find the text between string1= books.amazon=' and string2= ' (locate the text... (1 Reply)
Discussion started by: Hiano
1 Replies

5. Shell Programming and Scripting

Find the position of a field/column in a flat file

Hi, Let say I have a file which has around 400 fields. SampleFile ========= PATIENTID|FACILITY|................|TIME_LAST_VISITED_BY_MD|.....|STATUS| How is it possible to find out which field is TIME_LAST_VISITED_BY_MD?fro example by seeing the above structure we can saw FACILITY... (5 Replies)
Discussion started by: machomaddy
5 Replies

6. UNIX for Dummies Questions & Answers

Inserting a sequential number into a field on a flat file

I have a csv flatfile with a few million rows. I need to replace a field (field number is 85) in the file with a sequential number. As an example, let's assume there are only 4 fields in the file: A,A,,32 A,A,,27 A,B,,43 C,C,,354 If I wanted to amend the 3rd field in this way my... (2 Replies)
Discussion started by: BristolSmithy
2 Replies

7. UNIX for Dummies Questions & Answers

To Add extra commas to a CSV file.

Hi All, I got this requirement to process a complex CSV file. Eg File. Line 1: Name:,XYz Line 2: Age:,15 Line 3: Grade:,7 Line 4: Line 5: English, Maths, Science,Spanish Line 6:10,11,13,14 As you can see the maximum column is 4 . The file i need to make is Line 1: Name:,XYz,,... (12 Replies)
Discussion started by: chillblue
12 Replies

8. Shell Programming and Scripting

awk to place value at 24 field in a flat file issue

I am trying to add 0393 value at 24th feild using the below command, but its adding at all the lines including header and trailer Input file: ZHV|2657|D0217001|T|TXU|Z|PAN|20131112000552||||OPER| 754|52479| 492|489|SP40|1014570286334|20131111|20131201|14355334|CHAMELON... (1 Reply)
Discussion started by: Aditya_001
1 Replies

9. Shell Programming and Scripting

Adding Extra Column in txt file base on Condition

HI Guys, I have below input. Output Base on Below Condition. 1> if forth column is empty and next coming line have same name with \es then add that column name on all rows 2>rest of all are es:vsDataEUtranCellFDD Input:- CCL01736 CCL01736_7A_1 es:vsDataEUtranCellFDD ... (3 Replies)
Discussion started by: pareshkp
3 Replies

10. Windows & DOS: Issues & Discussions

2 Questions: replace text in txt file, add text to end of txt file

so... Lets assume I have a text file. The text file contains multiple "#" symbols. I want to replace all thos "#"s with a STRING using DOS/Batch I want to add a certain TEXT to the end of each line. How can I do this WITHOUT aid of sed, grep or anything linux related ? (1 Reply)
Discussion started by: pasc
1 Replies
audit_data(4)							   File Formats 						     audit_data(4)

NAME
audit_data - current information on audit daemon SYNOPSIS
/etc/security/audit_data DESCRIPTION
The audit_data file contains information about the audit daemon. The file contains the process ID of the audit daemon, and the pathname of the current audit log file. The format of the file is: pid>:<pathname> Where pid is the process ID for the audit daemon, and pathname is the full pathname for the current audit log file. EXAMPLES
Example 1: A sample audit_data file. 64:/etc/security/audit/server1/19930506081249.19930506230945.bongos FILES
/etc/security/audit_data ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Obsolete | +-----------------------------+-----------------------------+ SEE ALSO
audit(1M), auditd(1M), bsmconv(1M), audit(2), audit_control(4), audit.log(4) NOTES
The functionality described on this manual page is internal to audit(1M) and might not be supported in a future release. The auditd utility is the only supported mechanism to communicate with auditd(1M). The current audit log can be determined by examining the configured audit directories. See audit_control(4). The functionality described on this manual page is available only if the Basic Security Module (BSM) has been enabled. See bsmconv(1M) for more information. SunOS 5.10 14 Nov 2002 audit_data(4)
All times are GMT -4. The time now is 01:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy