Sponsored Content
Full Discussion: script for splitting file
Top Forums Shell Programming and Scripting script for splitting file Post 302512774 by Sudhakishore.P on Monday 11th of April 2011 03:19:12 PM
Old 04-11-2011
script for splitting file

Can anyone help me in giving a script for the below scenario

I have file from the source increamenting in size...

I require to write a script witch will move the data to the new file once the file reaches 50MB of size .
This needs If the first file reaches 50MB then my script has to generate a new file which again store the data upto to 50MB size and so on..... untill the
end of the file.


1st file -- 50MB
2nd file -- 50MB
3nd file -- 50MB
------
------------
Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with shell script - splitting

Hi, I need to split the file lines in below format as. Input file : Sample.txt <Rule expression="DeliverToCompID IS NULL" invert="true"> <Rule field="PossDupFlag" value="Y" > <Rule expression="OrdStatus = '2' AND OrigClOrdID IS NULL"> Output... (5 Replies)
Discussion started by: manosubsulo
5 Replies

2. Shell Programming and Scripting

File splitting and grouping using unix script

Hello All, I have a small problem with file group/splitting and I am trying to get the best way to perform this in unix. I am trying with awk but need some suggestion what would be the best and fastest way to-do it. Here is the problem. I have a fixed length file with filled with product... (4 Replies)
Discussion started by: nandhan11891
4 Replies

3. UNIX for Dummies Questions & Answers

Is there any way of splitting the script (Noob Here).

I m writing a script to check Server Hardening. The problem is whenever i add new point it grows and it become very tedious to edit the script file. Is there any way of making them separate and call them from one base script? Is it possible to define global variable that can be accessed via... (5 Replies)
Discussion started by: pinga123
5 Replies

4. Shell Programming and Scripting

Splitting a file in to multiple files and passing each individual file to a command

I have an input file with contents like: MainFile.dat: 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 ... (4 Replies)
Discussion started by: rkrish
4 Replies

5. Shell Programming and Scripting

Splitting a file and creating new files using Perl script

Hi All, I am new to Scripting language. I want to split a file and create several subfiles using Perl script. Example : File format : Sourcename ID Date Nbr SU IMYFDJ 9/17/2012 5552159976555 SU BWZMIG 9/14/2012 1952257857887 AR PEHQDF 11/26/2012 ... (13 Replies)
Discussion started by: Deepak9870
13 Replies

6. Shell Programming and Scripting

Splitting XML file on basis of line number into multiple file

Hi All, I have more than half million lines of XML file , wanted to split in four files in a such a way that top 7 lines should be present in each file on top and bottom line of should be present in each file at bottom. from the 8th line actual record starts and each record contains 15 lines... (14 Replies)
Discussion started by: ajju
14 Replies

7. Shell Programming and Scripting

Execution of loop :Splitting a single file into multiple .dat file

hdr=$(cut -c1 $path$file|head -1)#extract header”H” trl=$(cut -c|path$file|tail -1)#extract trailer “T” SplitFile=$(cut -c 50-250 $path 1$newfile |sed'$/ *$//' head -1')# to trim white space and extract table name If; then # start loop if it is a header While read I #read file Do... (4 Replies)
Discussion started by: SwagatikaP1
4 Replies

8. UNIX for Dummies Questions & Answers

File splitting script help

Hi All, I have file in my system with below data PP1234512345671234567CABC PP1234512345671234567BABC PP1234512345671234567BABC PP1234512345671234567CABC PP1234512345671234567DABC PP1234512345671234567EABC PP1234512345671234567DABC PP1234512345671234567EABC... (10 Replies)
Discussion started by: ibrar Ahmad
10 Replies

9. Shell Programming and Scripting

Script for splitting file of records into multiple files

Hello I have a file of following format HDR 1234 abc qwerty abc def ghi jkl HDR 4567 xyz qwerty abc def ghi jkl HDR 890 mno qwerty abc def ghi jkl HDR 1234 abc qwerty abc def ghi jkl HDR 1234 abc qwerty abc def ghi jkl -Need to split this into multiple files based on tag... (8 Replies)
Discussion started by: wincrazy
8 Replies

10. Shell Programming and Scripting

Splitting a text file into smaller files with awk, how to create a different name for each new file

Hello, I have some large text files that look like, putrescine Mrv1583 01041713302D 6 5 0 0 0 0 999 V2000 2.0928 -0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 5.6650 0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 3.5217 ... (3 Replies)
Discussion started by: LMHmedchem
3 Replies
projmod(1M)						  System Administration Commands					       projmod(1M)

NAME
projmod - modify a project's information on the system SYNOPSIS
projmod [-n] [-f filename] [-p projid [-o]] [-c comment] [-a|-s|-r] [-U user [,user...] ] [-G group [,group...] ] [ [-K name [=value [,value...]...]]] [-l new_projectname] project DESCRIPTION
The projmod utility modifies a project's definition on the system. projmod changes the definition of the specified project and makes the appropriate project-related system file and file system changes. OPTIONS
The following options are supported: -a Specify that the users, groups, attributes, or attribute values specified by the -U, -G or -K options should be added to the project, rather than replacing the existing member or attribute list. -c comment Specify comment as a text string. Generally, comment contains a short description of the project. This information is stored in the project's /etc/project entry. -f filename Specify the project file to modify. If no filename is specified, the system project file, /etc/project, is modified. -G group [,group...] Specify a replacement list of member groups of the project. When used in conjunction with the -a or -r options, this option specifies a list of groups to be added or removed from the project. -K name[=value[,value...] Specify a replacement list of project attributes for the project. When used in conjunction with the -a, -r, or -s options, this option specifies a list of attribute values to be added, removed, or replaced in the project. Attributes must be delimited by semicolons (;). Multiple -K options can be specified to set, add, remove, or substitute values on multiple keys, such as: -K key1=value1 -K "key2=(value2a),(value2b)" Resource control attributes use parentheses to specify values for a key. Because many user shells interpret parentheses as special characters, it is best to enclose an argument to -K that contains parentheses with double quotes, as shown above and in EXAMPLES, below. See resource_controls(5) for a description of the resource controls you can specify for a project. -l new_projectname Specify the new project name for the project. The new_projectname argument is a string consisting of characters from the set of alpha- betic characters, numeric characters, period (.), underline (_), and hyphen (-). The first character should be alphabetic. An error message is written if these restrictions are not met. The project name must also be unique within the project file. -n Syntax check. Check the format of the existing system project file and modifications only. The contents of the existing project file, such as user names, group names, and resources that are specified in the project attributes are not checked. -o This option allows the project ID specified by the -p option to be non-unique within the project file. -p projid Specify a new project ID for the project. It must be a non-negative decimal integer less than MAXUID as defined in param.h. This value must be unique within the project file if the -o option is not specified. -r Specify that the users, groups, attributes, or attribute values specified by the -U, -G or -K options should be removed from the project, rather than replacing the existing member or attribute list. -s Specify that the list of attributes specified by the -K option should have their values replaced. If the attributes do not exist, they are added as if the a option was used. This option has no effect the -U or -G options. -U user [,user...] Specify a replacement list of member users of the project. When used in conjunction with the -a or -r options, this option specifies a list of users to be added or removed from the project. OPERANDS
The following operands are supported: project An existing project name to be modified or displayed. (none) If no operand is given, the project file is validated without modifying any project. EXAMPLES
Example 1: Using the -K Option for Addition of an Attribute Value Consider the following project(4) entry: salesaudit:111:Auditing Project::sales,finance: process.max-file-size=(priv,52428800,deny); task.max-lwps=(priv,100,deny) The preceding would appear as one line in /etc/project. For this and the following examples, the focus is on the attributes field in the project entry. That is, the last field, the field following the last semicolon. The attributes field for the project salesaudit lists the following resource control: task.max-lwps=(priv,1000,signal=KILL) The following projmod command adds an action clause to the preceding entry: # projmod -a -K "task.max-lwps=(priv,100,deny)" salesaudit ...with the resulting attributes field in the entry for salesaudit: task.max-lwps=(priv,100,deny),(priv,1000,signal=KILL) Example 2: Using the -K Option for the Substitution of an Attribute Value Assume an attributes field in a project(4) entry for the project salesaudit that lists the following resource control: task.max-lwps=(priv,100,deny),(priv,1000,signal=KILL) The following projmod command substitutes the action clause specified in the command for the action clauses in the preceding entry: # projmod -s -K "task.max-lwps=(priv,500,signal=SIGSTOP)" salesaudit ...with the resulting attributes field in the entry for salesaudit: task.max-lwps=(priv,500,signal=SIGSTOP) Example 3: Using the -K Option for Removal of an Attribute Value Assume an attributes field in a project(4) entry for a project salesaudit that lists the following resource control: task.max-lwps=(priv,100,deny),(priv,1000,signal=KILL) The following projmod command removes the first action clause from the preceding entry: # projmod -r -K "task.max-lwps=(priv,100,deny)" salesaudit ...with the resulting attributes field in the entry for salesaudit: task.max-lwps=(priv,1000,signal=KILL) Example 4: Specifying Multiple Attribute Values Suppose you want to achieve the following resource controls for the project salesaudit: task.max-lwps=(priv,100,deny) process.max-file-size=(priv,50MB,deny) The following projmod command adds these resource controls for salesaudit: # projmod -a -K "task.max-lwps=(priv,100,deny)" -K "process.max-file-size=(priv,50MB,deny)" salesaudit ...with the resulting attributes field in the entry for salesaudit: task.max-lwps=(priv,100,deny);process.max-file-size=(priv,52428800,deny) In this example, note the effect of the use of the modifier and scaling factor for the resource control process.max-file-size. The specifi- cation in projmod: "process.max-file-size=(priv,50MB,deny)" ...becomes, in /etc/project: process.max-file-size=(priv,52428800,deny) That is, 50MB is expanded to 52428800. The modifiers, such as MB, and scaling factors you can use for resource controls are specified in resource_controls(5). Example 5: Binding a Pool to a Project The following command sets the project.pool attribute for the project sales. # projmod -a -K project.pool=salespool sales EXIT STATUS
In case of an error, projmod prints an error message and exits with one of the following values: The following exit values are returned: 0 Successful completion. 2 The command syntax was invalid. A usage message for projmod is displayed. 3 An invalid argument was provided to an option. 4 The projid given with the -p option is already in use. 5 The project files contain an error. See project(4). 6 The project to be modified, group, user, or resource does not exist. 9 The project is already in use. 10 Cannot update the /etc/project file. FILES
/etc/group System file containing group definitions /etc/project System project file /etc/passwd System password file /etc/shadow System file containing users' encrypted passwords and related information ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +------------------------------+----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +------------------------------+----------------------------+ |Availability | SUNWesu | +------------------------------+----------------------------+ |Interface Stability | See below. | +------------------------------+----------------------------+ Invocation is evolving. Human readable output is unstable. SEE ALSO
groupadd(1M), groupdel(1M), groupmod(1M), projadd(1M), projdel(1M), useradd(1M), userdel(1M), usermod(1M), passwd(4), project(4), attributes(5), resource_controls(5) NOTES
The projmod utility modifies project definitions only in the local /etc/project file. If a network name service such as NIS or LDAP is being used to supplement the local files with additional entries, projmod cannot change information supplied by the network name service. However projmod verifies the uniqueness of project name and project ID against the external name service. SunOS 5.10 6 Dec 2004 projmod(1M)
All times are GMT -4. The time now is 02:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy