05-19-2008
split single file into many
Hello,
We have a text file with more than 1500 paragraphs.
There is a blank line to separate paragraphs.
We need to create one text file (with any name but unique) per paragraph. In other words, how can i extract each paragraph and create a separate file with those contents (so 1500 text files as 1500 paragraphs)?
TIA
Prvn
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,I have a single sql file containing many create table ddl's.Example:
CREATE TABLE sec_afs
(
rpt_per_typ_c char(1) NOT NULL,
rpt_per_typ_t varchar(20) NULL,
LOCK ALLPAGES
go
EXEC sp_primarykey 'sec_afs', rpt_per_typ_c
go
GRANT SELECT ON sec_afs TO developer_read_only... (5 Replies)
Discussion started by: smarter_aries
5 Replies
2. Shell Programming and Scripting
Dear All,
I would like to split a file of the following format into multiple files based on the number in the 6th column (numbers 1, 2, 3...):
ATOM 1 N GLY A 1 -3.198 27.537 -5.958 1.00 0.00 N
ATOM 2 CA GLY A 1 -2.199 28.399 -6.617 1.00 0.00 ... (3 Replies)
Discussion started by: tomasl
3 Replies
3. Shell Programming and Scripting
Hi folks,
Happy new year.
I have a file 'filename' that i wd like to split basing on the contents in the last column.
The 'filename' content looks like
256772744788,9,11
256772744805,9,11
256772744792,9,11
256775543055,10,12
256782625357,9,12
256772368953,10,13
256772627735,10,13... (3 Replies)
Discussion started by: jerkesler
3 Replies
4. Shell Programming and Scripting
Let's assume that I have a file name called ‘A' and it has 100 lines in it and would like to split these 100 lines into 4 files as specified bellow.
INPUT: Input file name A
1
2
3
4
5
6
7
8
9
........100
Output: 4 output files (x,y,z,w)
File x should contains (Skip 4 lines)... (15 Replies)
Discussion started by: subbarao25
15 Replies
5. Shell Programming and Scripting
Hi all,
I wanted to split a single line into two line.
For example:
A/B/C 10
i want this output
var1 = A/B/C
var2 = 10
How do i get this. (2 Replies)
Discussion started by: ch33ry
2 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I am new to unix. we have a requirement here to split a single file into multiples files based on the number of people available for processing. So i tried my hand at writing some code as below.
#!/bin/bash
var1=`wc -l $filename`
var2=$var1/$splitno
split -l $var2 $1
Please help me... (6 Replies)
Discussion started by: quirkguy
6 Replies
7. Shell Programming and Scripting
I have one single shown below and I need to break each ST|850 & SE to separate file using unix script. Below example should create 3 files. We can use ST & SE to filter as these field names will remain same.
Please advice with the unix code.
ST|850
BEG|PO|1234
LIN|1|23
SE|4
ST|850... (3 Replies)
Discussion started by: prasadm
3 Replies
8. UNIX for Dummies Questions & Answers
input file:
AD,00,--,---,---,---,---,---,---,--,--,---
AM,000,---,---,---,---,---,---
AR, ,---,--,---,---
AA,---,---,---,---
AT,---
AU,---,---,---
AS,---,---
AP,---,---,---
AI,---
AD,00,---,---,---, ,---,---,---,---,---,---
AM,000,---,---,---
AR,... (6 Replies)
Discussion started by: kcdg859
6 Replies
9. Shell Programming and Scripting
Hi All,
I have the sales_data.csv file in the directory as below.
SDDCCR; SOM ; MD6546474777 ;05-JAN-16
ABC ; KIRAN ; CB789 ;04-JAN-16
ABC ; RAMANA; KS566767477747 ;06-JAN-16
ABC ; KAMESH; A33535335 ;04-JAN-16
SDDCCR; DINESH; GD6674474747 ;08-JAN-16... (4 Replies)
Discussion started by: ROCK_PLSQL
4 Replies
10. Shell Programming and Scripting
I have a variable that contains the following string:
FPATH=-rw-rw-r-- 1 user1 dba 0 Aug 7 13:14 /app/F11.3/app/cust/exe/filename1.exe' -rw-rw-r-- 1 user1 dba 0 Aug 19 10:09 /app/app/F11.3/app/cust/sql/33211.sql' -rw-r--r-- 1 user1 dba 0 Aug 6 17:20 /app/F11.2/app/01/mrt/file1.mrt'
I... (7 Replies)
Discussion started by: mohtashims
7 Replies
LEARN ABOUT DEBIAN
pod::elemental::selectors
Pod::Elemental::Selectors(3pm) User Contributed Perl Documentation Pod::Elemental::Selectors(3pm)
NAME
Pod::Elemental::Selectors - predicates for selecting elements
VERSION
version 0.102362
OVERVIEW
Pod::Elemental::Selectors provides a number of routines to check for Pod::Elemental paragraphs with given qualities.
SELECTORS
Selectors are predicates: they examine paragraphs and return either true or false. All the selectors have (by default) names like:
"s_whatever". They expect zero or more parameters to affect the selection. If these parameters are given, but no paragraph, a callback
will be returned that will expect a paragraph. If a paragraph is given, the selector will return immediately.
For example, the "s_command" selector expects a parameter that can be the name of the command desired. Both of the following uses are
valid:
# create and use a callback:
my $selector = s_command('head1');
my @headers = grep { $selector->($_) } @paragraphs;
# just check a paragraph right now:
if ( s_command('head1', $paragraph) ) { ... }
The selectors can be imported individually or as the "-all" group, and can be renamed with Sub::Exporter features. (Selectors cannot yet
be curried by Sub::Exporter.)
s_blank
my $callback = s_blank;
if( s_blank($para) ) { ... }
"s_blank" tests whether a paragraph is a Generic::Blank element.
s_flat
my $callback = s_flat;
if( s_flat($para) ) { ... }
"s_flat" tests whether a paragraph does Pod::Elemental::Flat -- in other words, is content-only.
s_node
my $callback = s_node;
if( s_node($para) ) { ... }
"s_node" tests whether a paragraph does Pod::Elemental::Node -- in other words, whether it may have children.
s_command
my $callback = s_command;
my $callback = s_command( $command_name);
my $callback = s_command(@command_names);
if( s_command(undef, $para) ) { ... }
if( s_command( $command_name, $para) ) { ... }
if( s_command(@command_names, $para) ) { ... }
"s_command" tests whether a paragraph does Pod::Elemental::Command. If a command name (or a reference to an array of command names) is
given, the tested paragraph's command must match one of the given command names.
AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-05-05 Pod::Elemental::Selectors(3pm)