Find the answer to your Linux question:
Results 1 to 3 of 3
how do you split text or .c files in text mode...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2004
    Location
    Somwhere in India
    Posts
    11

    split txt files


    how do you split text or .c files in text mode

  2. #2
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    158
    There is a split command that breaks big files into smaller pieces?
    That what you mean?

    try
    Code:
    man split
    and see if that meets your needs.

  3. #3
    Linux User
    Join Date
    Sep 2003
    Posts
    254

    Re: split txt files

    Quote Originally Posted by nsm09
    how do you split text or .c files in text mode
    I use perl
    Code:
    #!/usr/bin/perl
    
    open &#40;SOURCE , "<mysource.c>"&#41;;
    open &#40;DESTINATION ">myresult.c>"&#41;;
    
    while &#40;$line=<SOURCE>&#41;
    &#123;
        split/whatuwantosplit/$line/;
        print DESTINATION "$line";
    &#125;
    I write this code like that don't test it or even debug (not enough time right now (u see I'm just seeing I forgot to close my source and destination file)

    U could use sed but I don't know if u could use split as itself (I will test that and tell u if u want)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •