Sponsored Content
Top Forums Shell Programming and Scripting [ask]break line number into several parts Post 302533876 by yazu on Saturday 25th of June 2011 08:19:26 AM
Old 06-25-2011
split should work for your needs. If not try this perl script:
Code:
#!/usr/bin/env perl

# Usage: THIS_SCRIPT FILENAME

use warnings;
use strict;

# change for your needs
my $LINES=1000_000;
my $PREFIX='part';

my $cur=1;
my $out=$PREFIX . $cur;
open my $fh,'>', $out or die "$!";

while (<>) {
    if ( !($.%$LINES) ) {
		close $fh;
        $out = $PREFIX . ++$cur;
        open $fh, '>', $out or die "$!";
    }
    print $fh $_;
}

close $fh;

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

removing parts of a line with SED

hi, i'm trying to erase all the characters after, and including, the first test test Output: test1 test2 test3 this is what I tried, but didn't work sed "s/*//" file > testfilename any suggestions? thanks, gammmaman (2 Replies)
Discussion started by: gammaman
2 Replies

2. Shell Programming and Scripting

deleting certain parts of a line in perl

I have a filr data.txt. Its contents are Available labels (* indicates activated, I indicates installed, R idicates running): abc-3.0.3 def-3.0.4 xyz-3.1.2-1.0 I want to delete " Available labels (* indicates activated, I indicates installed, R idicates running):" and... (3 Replies)
Discussion started by: lassimanji
3 Replies

3. Shell Programming and Scripting

How can i break a text file into parts that occur between a specific pattern

How can i break a text file into parts that occur between a specific pattern? I have text file having various xml many tags like which starts with the tag "<?xml version="1.0" encoding="utf-8"?>" . I have to break the whole file into several xmls by looking for the above pattern. All the... (9 Replies)
Discussion started by: abhinav192
9 Replies

4. UNIX for Dummies Questions & Answers

How to read contents of a file from a given line number upto line number again specified by user

Hello Everyone. I am trying to display contains of a file from a specific line to a specific line(let say, from line number 3 to line number 5). For this I got the shell script as shown below: if ; then if ; then tail +$1 $3 | head -n $2 else ... (5 Replies)
Discussion started by: grc
5 Replies

5. Shell Programming and Scripting

BASH: Break line, read, break again, read again...

...when the lines use both a colon and commas to separate the parts you want read as information. The first version of this script used cut and other non-Bash-builtins, frequently, which made it nice and zippy with little more than average processor load in GNOME Terminal but, predictably, slow... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

6. Shell Programming and Scripting

Add line break for each line in a file

I cannot seem to get this to work.. I have a file which has about 100 lines, and there is no end of line (line break \n) at the end of each line, and this is causing problem when i paste them into an application. the file looks like this this is a test that is a test balblblablblhblbha... (1 Reply)
Discussion started by: fedora
1 Replies

7. Shell Programming and Scripting

Incrementing parts of ten digits number by parts

I have number in file which contains date and serial number: 2013101000. The last two digits are serial number (00). So maximum of serial number is 100. After reaching 100 it becomes 00 with incrementing 10 which is day with max 31. after reaching 31 it becomes 00 and increments 10... (31 Replies)
Discussion started by: Natalie
31 Replies

8. Shell Programming and Scripting

Break up file into n number of subsets and run in parallel

Hi Guys, I want to break down one of my input files into say 25 parts , run the same script in parallel and then merge the output into a single script. I have access to computing resources that can deal with 25 files, if I just run the original file the total time is about 15 days every time.... (6 Replies)
Discussion started by: gina.lizar
6 Replies

9. Shell Programming and Scripting

Split line in 4 parts

Hi Guys, I have file A.txt 1 2 3 4 5 6 7 8 9 10 11 Want Output :- 1 2 3 (3 Replies)
Discussion started by: pareshkp
3 Replies

10. Shell Programming and Scripting

Extract parts of the line

I have a long list of lines in a txt file which i'm only interested to extract the list of domains like the colored ones. domain.com domain.com/page codes $.09 domain.org domain.org/page2/ codes $0.10 domain.net domain.net/page03 codes $0.05 domain.info ... (3 Replies)
Discussion started by: garfish
3 Replies
LIBCDAUDIO-CONFIG(1)					     libcdaudio helper script					      LIBCDAUDIO-CONFIG(1)

NAME
libcdaudio-config - script to get information about the installed version of libcdaudio SYNOPSIS
libcdaudio-config [--prefix [=DIR] [--exec-prefix [=DIR] [--version] [--libs] [--cflags] DESCRIPTION
libcdaudio-config is a tool that is used to configure to determine the compiler and linker flags that should be used to compile and link programs that use libcdaudio. It is also used internally to the .m4 macros for GNU autoconf that are included with libcdaudio. OPTIONS
--version Print the currently installed version of libcdaudio on the standard output. --libs Print the linker flags that are necessary to link a libcdaudio program. --cflags Print the compiler flags that are necessary to compile a libcdaudio program. --prefix=PREFIX If specified, use PREFIX instead of the installation prefix that libcdaudio was built with when computing the output for the --cflags and --libs options. This option is also used for the exec prefix if --exec-prefix was not specified. This option must be specified before any --libs or --cflags options. --exec-prefix=PREFIX If specified, use PREFIX instead of the installation exec prefix that libcdaudio was built with when computing the output for the --cflags and --libs options. This option must be specified before any --libs or --cflags options. COPYRIGHT
Copyright (C) 1998 Owen Taylor Copyright (C) 2001 Matt Kraai Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, pro- vided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in sup- porting documentation. 0.99.4 12 February 2001 LIBCDAUDIO-CONFIG(1)
All times are GMT -4. The time now is 06:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy