Sponsored Content
Full Discussion: Split and Rename Split Files
Top Forums UNIX for Beginners Questions & Answers Split and Rename Split Files Post 303015019 by techedipro on Monday 26th of March 2018 10:16:28 AM
Old 03-26-2018
Thanks Don.

Can you please explain me in detail as to how the code works.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Split a file with no pattern -- Split, Csplit, Awk

I have gone through all the threads in the forum and tested out different things. I am trying to split a 3GB file into multiple files. Some files are even larger than this. For example: split -l 3000000 filename.txt This is very slow and it splits the file with 3 million records in each... (10 Replies)
Discussion started by: madhunk
10 Replies

2. Shell Programming and Scripting

split and rename the file

Hi All, I have a requirement .I want to split a file and the split files should have certain names. Currently when i use the split command split -1000 testdata testdata_ Then the output is testdata_aa testdata_bb testdata_cc and so on. But i want the output as testdata1.snd... (3 Replies)
Discussion started by: dnat
3 Replies

3. Shell Programming and Scripting

awk split and rename files

I have a file test1.html like below: <dctm_topnav_en_US> <html> ..... </html> <dctm_topnav_en_CA> <html> ..... </html> <dctm_topnav_en_FR> <html> ..... </html> I need to use awk to split this into three file names like en_US.html , en_CA.html, en_FR.html each having content between... (4 Replies)
Discussion started by: vijay52
4 Replies

4. UNIX for Dummies Questions & Answers

Split then rename

Hi everyone, I am trying to write an if statement that will split a file if it is over 1 million records/lines into files with say 900,000 records and then rename those files without the aaa, aab, aac format that splitting normally does and into a specific naming convention. For instance, if... (2 Replies)
Discussion started by: coach5779
2 Replies

5. UNIX for Dummies Questions & Answers

Split and Rename files using Terminal and bin/bash

I have a file named Me_thread_spell.txt that I want to split into smaller files. I want it to be split in each place there is a ;;;. For example, blah blah blah ;;; blah bhlah hlabl awasnceuir asenduhfoijhacseiodnbfxasd;;; oabwcuhaweoir;;; This full file would be three separate files... (7 Replies)
Discussion started by: mschpers
7 Replies

6. Shell Programming and Scripting

awk to split one field and print the last two fields within the split part.

Hello; I have a file consists of 4 columns separated by tab. The problem is the third fields. Some of the them are very long but can be split by the vertical bar "|". Also some of them do not contain the string "UniProt", but I could ignore it at this moment, and sort the file afterwards. Here is... (5 Replies)
Discussion started by: yifangt
5 Replies

7. UNIX for Dummies Questions & Answers

Split and Rename multiple files

Hi, I have a data file like below messageid|email|timestamp 750452173|123@googlemail.com|2013-05-24 16:14:32 750464921|000@gmail.com|2013-06-13 19:38:01 750385426|001@googlemail.com|2013-01-06 12:06:36 750373470|000@wz.eu|2012-11-30 22:32:07 . . I want to split the files based on the... (4 Replies)
Discussion started by: armsaran
4 Replies

8. Shell Programming and Scripting

Split and rename files

Hello, Need to split files into n number of files and rename the files Example: Input: transaction.txt.1aa transaction.txt.1ab ...... Output: transaction.txt.1 transaction.txt.2 transaction.txt.3 (3 Replies)
Discussion started by: krux_rap
3 Replies

9. Shell Programming and Scripting

awk : split file and rename and save in path according to content

Hello, I'm using Windows 7 ; sed, awk and gnuwin32 are installed. I have a big text file I need to manipulate. In short, I will have to split it in thousands of short files, then rename and save in a folder which name is based upon filename. Here is a snippet of my big input.txt file (this... (4 Replies)
Discussion started by: sellig
4 Replies

10. UNIX for Beginners Questions & Answers

Automate splitting of files , scp files as each split completes and combine files on target server

i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Discussion started by: malaika
2 Replies
explain_rename(3)					     Library Functions Manual						 explain_rename(3)

NAME
explain_rename - explain rename(2) errors SYNOPSIS
#include <libexplain/rename.h> const char *explain_rename(const char *oldpath, const char *newpath); const char *explain_errno_rename(int errnum, const char *oldpath, const char *newpath); void explain_message_rename(char *message, int message_size, const char *oldpath, const char *newpath); void explain_message_errno_rename(char *message, int message_size, int errnum, const char *oldpath, const char *newpath); DESCRIPTION
The functions declared in the <libexplain/rename.h> include file may be used to explain errors returned by the rename(2) system call. explain_rename const char *explain_rename(const char *oldpath, const char *newpath); The explain_rename function is used to obtain an explanation of an error returned by the rename(2) function. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (rename(oldpath, rewpath) < 0) { fprintf(stderr, "%s ", explain_rename(oldpath, newpath)); exit(EXIT_FAILURE); } oldpath The original oldpath, exactly as passed to the rename(2) system call. newpath The original newpath, exactly as passed to the rename(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_errno_rename const char *explain_errno_rename(int errnum, const char *oldpath, const char *newpath); The explain_errno_rename function is used to obtain an explanation of an error returned by the rename(2) function. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (rename(oldpath, newpath) < 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_rename(err, oldpath, newpath)); exit(EXIT_FAILURE); } errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. oldpath The original oldpath, exactly as passed to the rename(2) system call. newpath The original newpath, exactly as passed to the rename(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_message_rename void explain_message_rename(char *message, int message_size, const char *oldpath, const char *newpath); The explain_message_rename function is used to obtain an explanation of an error returned by the rename(2) function. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (rename(oldpath, newpath) < 0) { char message[3000]; explain_message_rename(message, sizeof(message), oldpath, newpath); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } message The location in which to store the returned message. Because a message return buffer has been supplied, this function is thread safe, if the buffer is thread safe. message_size The size in bytes of the location in which to store the returned message. oldpath The original oldpath, exactly as passed to the rename(2) system call. newpath The original newpath, exactly as passed to the rename(2) system call. explain_message_errno_rename void explain_message_errno_rename(char *message, int message_size, int errnum, const char *oldpath, const char *newpath); The explain_message_errno_rename function is used to obtain an explanation of an error returned by the rename(2) function. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (rename(oldpath, newpath) < 0) { int err = errno; char message[3000]; explain_message_errno_rename(message, sizeof(message), err, oldpath, newpath); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } message The location in which to store the returned message. Because a message return buffer has been supplied, this function is thread safe, given a thread safe buffer. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. oldpath The original oldpath, exactly as passed to the rename(2) system call. newpath The original newpath, exactly as passed to the rename(2) system call. COPYRIGHT
libexplain version 0.52 Copyright (C) 2008 Peter Miller AUTHOR
Written by Peter Miller <pmiller@opensource.org.au> explain_rename(3)
All times are GMT -4. The time now is 02:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy