Sponsored Content
Full Discussion: Split file based on records
Top Forums Shell Programming and Scripting Split file based on records Post 302831843 by Ajay Venkatesan on Friday 12th of July 2013 03:13:47 AM
Old 07-12-2013
Hi Raja,adhvan,

This work. But when there is no Header and trailor in the file. Then this will strip off the first record which acuallly would have been the detail.

Instead i tried someting like this:
Code:
awk '{if (substr($0,1,1) == "D") {print $0;}}' Filename

This gets you the list of detail records. But i am not sure how to pass the output of this command to the split command?
Any suggetions on that?

Thanks,
Ajay

Last edited by Franklin52; 07-14-2013 at 05:59 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sort & Split records in a file

Hi, I am new to scripting. I need a script to sort and the records in a file and then split them into different files. For example, the file is: H1...................... H2...................... D2.................... D2.................... H1........................... (15 Replies)
Discussion started by: Sunitha_edi82
15 Replies

2. UNIX for Dummies Questions & Answers

Filtering records of a file based on a value of a column

Hi all, I would like to extract records of a file based on a condition. The file contains 47 fields, and I would like to extract only those records that match a certain value in one of the columns, e.g. COL1 COL2 COL3 ............... COL47 1 XX 45 ... (4 Replies)
Discussion started by: risk_sly
4 Replies

3. Shell Programming and Scripting

Based on num of records in file1 need to check records in file2 to set some condns

Hi All, I have two files say file1 and file2. I want to check the number of records in file1 and if its atleast 2 (i.e., 2 or greater than 2 ) then I have to check records in file2 .If records in file2 is atleast 1 (i.e. if its not empty ) i have to set some conditions . Could you pls... (3 Replies)
Discussion started by: mavesum
3 Replies

4. UNIX for Dummies Questions & Answers

How to split multiple records file in n files

Hello, Each record has a lenght of 7 characters I have 2 types of records 010 and 011 There is no character of end of line. For example my file is like that : 010hello 010bonjour011both 011sisters I would like to have 2 files 010.txt (2 records) hello bonjour and ... (1 Reply)
Discussion started by: jeuffeu
1 Replies

5. Shell Programming and Scripting

parallel while loop based on the file records

Hi, I need to execute parallel with while loop. Input File(source_file.csv) contains filenames the below source_file.csv file contains Customer1.txt Product1.txt Sales.txt Emp.txt Dept.txt Based on the number of rows that file I want to run the script ‘n' times. while... (2 Replies)
Discussion started by: onesuri
2 Replies

6. UNIX for Advanced & Expert Users

Split records based on '-'

HI, I have a pipe delimiter file , I have to search for second field pattern, if the second field does not contain a '-' , I need to start capturing the record from this line till I find another second field with '-' value. Below is the sample data SOURCE DATA ABC|ABC_702148-PARAM... (3 Replies)
Discussion started by: mora
3 Replies

7. Shell Programming and Scripting

Split records into multiple records

Hi All, I am trying to split a record into multiple records based on a value. Input.txt "A",1,0,10 "B",2,0,10,15,20 "C",3,11,14,16,19,21,23 "D",1,0,5 My desired output is: "A",1,0,10 "B",2,0,10 "B",2,15,20 "C",3,11,14 "C",3,16,19 "C",3,21,23 (4 Replies)
Discussion started by: kmsekhar
4 Replies

8. Shell Programming and Scripting

Filter records based on 2nd file

Hello, I want to filter records of a file if they fall in range associated with a second file. First the chr number (2nd col of 1st file and 1st col of 2nd file) needs to be matched. Then if the 3rd col of the first file falls within any of the ranges specified by the 2nd and 3rd cols , then... (4 Replies)
Discussion started by: ritakadm
4 Replies

9. Shell Programming and Scripting

Split a large file in n records and skip a particular record

Hello All, I have a large file, more than 50,000 lines, and I want to split it in even 5000 records. Which I can do using sed '1d;$d;' <filename> | awk 'NR%5000==1{x="F"++i;}{print > x}'Now I need to add one more condition that is not to break the file at 5000th record if the 5000th record... (20 Replies)
Discussion started by: ibmtech
20 Replies

10. Shell Programming and Scripting

Want to grep records in alphabetical order from a file and split into other files

Hi All, I have one file containing thousands of table names in single column. Now I want that file split into multiple files e.g one file containing table names starting from A, other containing all tables starting from B...and so on..till Z. I tried below but it did not work. for i in... (6 Replies)
Discussion started by: shekhar_4_u
6 Replies
VLLOG(5)							AFS File Reference							  VLLOG(5)

NAME
VLLog - Traces Volume Location Server operations DESCRIPTION
The VLLog file records a trace of Volume Location (VL) Server (vlserver process) operations on the local machine and describes any error conditions it encounters. If the VLLog file does not already exist in the /var/log/openafs directory when the VL Server starts, the server process creates it and writes initial start-up messages to it. If there is an existing file, the VL Server renames it to VLLog.old, overwriting the existing VLLog.old file if it exists. The file is in ASCII format. Administrators listed in the /etc/openafs/server/UserList file can use the bos getlog command to display its contents. Alternatively, log onto the server machine and use a text editor or a file display command such as the UNIX cat command. By default, the mode bits on the VLLog file grant the required "r" (read) permission to all users. The VL Server records operations only as it completes them, and cannot recover from failures by reviewing the file. The log contents are useful for administrative evaluation of process failures and other problems. The VL Server can record messages at three levels of detail. By default, it records only very rudimentary messages. To increase logging to the first level of detail, issue the following command while logged onto the database server machine as the local superuser "root". # kill -TSTP <vlserver_pid> where <vlserver_pid> is the process ID of the vlserver process, as reported in the output from the standard UNIX ps command. To increase to the second and third levels of detail, repeat the command. To disable logging, issue the following command. # kill -HUP <vlserver_pid> To decrease the level of logging, first completely disable it and then issue the "kill -TSTP" command as many times as necessary to reach the desired level. SEE ALSO
UserList(5), bos_getlog(8), vlserver(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 VLLOG(5)
All times are GMT -4. The time now is 11:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy