Sponsored Content
Full Discussion: Concatenate 560 files in one
Top Forums UNIX for Dummies Questions & Answers Concatenate 560 files in one Post 302761743 by jgt on Saturday 26th of January 2013 04:19:26 PM
Old 01-26-2013
Code:
p=2
k=0
cat EUR.1.fst >EUR.all.fst
    while [ p -lt 561 ]
        do
             while read line
               do
                if [ k -eq 1 ]
                  then
                           echo "$line" >>EUR.all.fst
                  fi
            k=1
        done <EUR.${p}.Fst
       p=`expr $p + 1`
       k=0
done

Untested
This User Gave Thanks to jgt For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to concatenate all files.

Hi, I'm totally new to Unix. I'm an MVS mainframer but ran into a situation where a Unix server I have available will help me. I want to be able to remotely connect to another server using FTP, login and MGET all files from it's root or home directory, logout, then login as a different user and do... (1 Reply)
Discussion started by: s80bob
1 Replies

2. Shell Programming and Scripting

concatenate two files with different No of rows

need a shell which perform following function file 1 ( every time new data comes) 1212 2323 3434 4545 5656 . . . . file 2 (fixed line) update bc_tbl set aix=data , bix=back where cix=U and serial=; now when i execute shell it will concatinate file 1, file 2 & make file 3 as... (3 Replies)
Discussion started by: The_Archer
3 Replies

3. Shell Programming and Scripting

Concatenate files

I have directory structure sales_only under which i have multiple directories for each dealer example: ../../../Sales_Only/xxx_Dealer ../../../Sales_Only/yyy_Dealer ../../../Sales_Only/zzz_Dealer Every day i have one file produce under each directory when the process runs. The requirement... (3 Replies)
Discussion started by: mohanmuthu
3 Replies

4. Shell Programming and Scripting

Concatenate files

Hi, I want to create a batch(bash) file to combine 23 files together. These files have the same extension. I want the final file is save to a given folder. Once it is done it will delete the 23 files. Thanks for help. Need script. (6 Replies)
Discussion started by: zhshqzyc
6 Replies

5. Shell Programming and Scripting

Concatenate files

I have a file named "file1" which has the following data 10000 20000 30000 And I have a file named "file2" which has the following data ABC DEF XYZ My output should be 10000ABC 20000DEF (3 Replies)
Discussion started by: bobby1015
3 Replies

6. Fedora

Concatenate Numerous Files

Hey! I wanted to find a text version of the Bible for purposes of grepping. The only files I could find, (in the translation I wanted), were Old Testament.txt and New Testament.txt. I thought, "fine, I'll just concatenate those two, no problemo." But when I unpacked them, turns out they had each... (22 Replies)
Discussion started by: sudon't
22 Replies

7. UNIX for Dummies Questions & Answers

Concatenate Several Files to One

Hi All, Need your help. I will need to concatenate around 100 files but each end of the file I will need to insert my name DIRT1228 on each of the file and before the next file is added and arrived with just one file for all the 100files. Appreciate your time. Dirt (6 Replies)
Discussion started by: dirt1228
6 Replies

8. UNIX for Dummies Questions & Answers

Concatenate files

Hi I am trying to learn linux step by step an i am wondering can i use cat command for concatenate files but i want to place context of file1 to a specific position in file2 place of file 2 and not at the end as it dose on default? Thank you. (3 Replies)
Discussion started by: iliya24
3 Replies

9. UNIX for Dummies Questions & Answers

Concatenate files and delete source files. Also have to add a comment.

- Concatenate files and delete source files. Also have to add a comment. - I need to concatenate 3 files which have the same characters in the beginning and have to remove those files and add a comment and the end. Example: cat REJ_FILE_ABC.txt REJ_FILE_XYZ.txt REJ_FILE_PQR.txt >... (0 Replies)
Discussion started by: eskay
0 Replies
LIBPROCSTAT(3)						   BSD Library Functions Manual 					    LIBPROCSTAT(3)

NAME
procstat_open_core, procstat_open_kvm, procstat_open_sysctl, procstat_close, procstat_getargv, procstat_getauxv, procstat_getenvv, procstat_getfiles, procstat_getgroups, procstat_getkstack, procstat_getosrel, procstat_getpathname, procstat_getprocs, procstat_getumask, procstat_getvmmap, procstat_freeargv, procstat_freeauxv, procstat_freeenvv, procstat_freefiles, procstat_freegroups, procstat_freekstack, procstat_freeprocs, procstat_freevmmap, procstat_get_pipe_info, procstat_get_pts_info, procstat_get_sem_info, procstat_get_shm_info, procstat_get_socket_info, procstat_get_vnode_info -- library interface for file and process information retrieval LIBRARY
library ``libprocstat'' SYNOPSIS
#include <sys/param.h> #include <sys/queue.h> #include <libprocstat.h> void procstat_close(struct procstat *procstat); void procstat_freeargv(struct procstat *procstat); void procstat_freeauxv(struct procstat *procstat, Elf_Auxinfo *auxv); void procstat_freeenvv(struct procstat *procstat); void procstat_freefiles(struct procstat *procstat, struct filestat_list *head); void procstat_freegroups(struct procstat *procstat, gid_t *groups); void procstat_freekstack(struct procstat *procstat, struct kinfo_kstack *kkstp); void procstat_freeprocs(struct procstat *procstat, struct kinfo_proc *p); void procstat_freevmmap(struct procstat *procstat, struct kinfo_vmentry *vmmap); int procstat_get_pipe_info(struct procstat *procstat, struct filestat *fst, struct pipestat *pipe, char *errbuf); int procstat_get_pts_info(struct procstat *procstat, struct filestat *fst, struct ptsstat *pts, char *errbuf); int procstat_get_sem_info(struct procstat *procstat, struct filestat *fst, struct semstat *sem, char *errbuf); int procstat_get_shm_info(struct procstat *procstat, struct filestat *fst, struct shmstat *shm, char *errbuf); int procstat_get_socket_info(struct procstat *procstat, struct filestat *fst, struct sockstat *sock, char *errbuf); int procstat_get_vnode_info(struct procstat *procstat, struct filestat *fst, struct vnstat *vn, char *errbuf); char ** procstat_getargv(struct procstat *procstat, const struct kinfo_proc *kp, size_t nchr, char *errbuf); Elf_Auxinfo * procstat_getauxv(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); char ** procstat_getenvv(struct procstat *procstat, const struct kinfo_proc *kp, size_t nchr, char *errbuf); struct filestat_list * procstat_getfiles(struct procstat *procstat, struct kinfo_proc *kp, int mmapped); gid_t * procstat_getgroups(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); int procstat_getosrel(struct procstat *procstat, struct kinfo_proc *kp, int *osrelp); struct kinfo_kstack * procstat_getkstack(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); struct kinfo_proc * procstat_getprocs(struct procstat *procstat, int what, int arg, unsigned int *count); int procstat_getpathname(struct procstat *procstat, struct kinfo_proc *kp, char *pathname, size_t maxlen); int procstat_getrlimit(struct procstat *procstat, struct kinfo_proc *kp, int which, struct rlimit* rlimit); int procstat_getumask(struct procstat *procstat, struct kinfo_proc *kp, unsigned short *maskp); struct kinfo_vmentry * procstat_getvmmap(struct procstat *procstat, struct kinfo_proc *kp, unsigned int *count); struct procstat * procstat_open_core(const char *filename); struct procstat * procstat_open_kvm(const char *nlistf, const char *memf); struct procstat * procstat_open_sysctl(void); DESCRIPTION
The libprocstat library contains the API for runtime file and process information retrieval from the running kernel via the sysctl(3) library backend, and for post-mortem analysis via the kvm(3) library backend, or from the process core(5) file, searching for statistics in special elf(3) note sections. The procstat_open_kvm() and procstat_open_sysctl() functions use the kvm(3) or sysctl(3) library routines, respectively, to access kernel state information used to retrieve processes and files states. The procstat_open_core() uses elf(3) routines to access statistics stored as a set of notes in a process core(5) file, written by the kernel at the moment of the process abnormal termination. The filename argument is the process core file name. The nlistf argument is the executable image of the kernel being examined. If this argument is NULL, the cur- rently running kernel is assumed. The memf argument is the kernel memory device file. If this argument is NULL, then /dev/mem is assumed. See kvm_open(3) for more details. The functions dynamically allocate and return a procstat structure pointer used in the rest of the libprocstat library routines until the corresponding procstat_close() call that cleans up the resources allocated by the procstat_open_*() functions. The procstat_getprocs() function gets a pointer to the procstat structure from one of the procstat_open_*() functions and returns a dynami- cally allocated (sub-)set of active processes in the kernel filled in to array of kinfo_proc structures. The what and arg arguments consti- tute a filtering predicate as described in the kvm_getprocs(3) function. The number of processes found is returned in the reference parame- ter cnt. The caller is responsible to free the allocated memory with a subsequent procstat_freeprocs() function call. The procstat_getargv() function gets a pointer to the procstat structure from one of the procstat_open_*() functions, a pointer to kinfo_proc structure from the array obtained from the kvm_getprocs() function, and returns a null-terminated argument vector that corresponds to the command line arguments passed to the process. The nchr argument indicates the maximum number of characters, including null bytes, to use in building the strings. If this amount is exceeded, the string causing the overflow is truncated and the partial result is returned. This is handy for programs that print only a one line summary of a command and should not copy out large amounts of text only to ignore it. If nchr is zero, no limit is imposed and all argument strings are returned. The values of the returned argument vector refer the strings stored in the procstat internal buffer. A subsequent call of the function with the same procstat argument will reuse the buffer. To free the allo- cated memory procstat_freeargv() function call can be used, or it will be released on procstat_close(). The procstat_getenvv() function is similar to procstat_getargv() but returns the vector of environment strings. The caller may free the allocated memory with a subsequent procstat_freeenv() function call. The procstat_getauxv() function gets a pointer to the procstat structure, a pointer to kinfo_proc structure, and returns the auxiliary vector as a dynamically allocated array of Elf_Auxinfo elements. The caller is responsible to free the allocated memory with a subsequent procstat_freeauxv() function call. The procstat_getfiles() function gets a pointer to the procstat structure initialized with one of the procstat_open_*() functions, a pointer to kinfo_proc structure from the array obtained from the kvm_getprocs() function, and returns a dynamically allocated linked list of filled in filestat_list structures using the STAILQ macros defined in queue(3). The caller is responsible to free the allocated memory with a sub- sequent procstat_freefiles() function call. The procstat_getgroups() function gets a pointer to the procstat structure, a pointer to kinfo_proc structure, and returns the process groups as a dynamically allocated array of gid_t elements. The caller is responsible to free the allocated memory with a subsequent procstat_freegroups() function call. The procstat_getkstack() function gets a pointer to the procstat structure initialized with one of the procstat_open_*() functions, a pointer to kinfo_proc structure, and returns kernel stacks of the process as a dynamically allocated array of kinfo_kstack structures. The caller is responsible to free the allocated memory with a subsequent procstat_freekstack() function call. The procstat_getosrel() function gets a pointer to the procstat structure, a pointer to kinfo_proc structure, and returns osrel date in the 3rd reference parameter. The procstat_getpathname() function gets a pointer to the procstat structure, a pointer to kinfo_proc structure, and copies the path of the process executable to pathname buffer, limiting to maxlen characters. The procstat_getrlimit() function gets a pointer to the procstat structure, a pointer to kinfo_proc structure, resource index which, and returns the actual resource limit in the 4th reference parameter. The procstat_getumask() function gets a pointer to the procstat structure, a pointer to kinfo_proc structure, and returns the process umask in the 3rd reference parameter. The procstat_getvmmap() function gets a pointer to the procstat structure initialized with one of the procstat_open_*() functions, a pointer to kinfo_proc structure, and returns VM layout of the process as a dynamically allocated array of kinfo_vmentry structures. The caller is responsible to free the allocated memory with a subsequent procstat_freevmmap() function call. The procstat_get_pipe_info(), procstat_get_pts_info(), procstat_get_sem_info(), procstat_get_shm_info(), procstat_get_socket_info() and procstat_get_vnode_info() functions are used to retrieve information about pipes, pseudo-terminals, semaphores, shared memory objects, sock- ets, and vnodes, respectively. Each of them have a similar interface API. The procstat argument is a pointer obtained from one of procstat_open_*() functions. The filestat fst argument is an element of STAILQ linked list as obtained from the procstat_getfiles() func- tion. The filestat structure contains a fs_type field that specifies a file type and a corresponding function to be called among the procstat_get_*_info function family. The actual object is returned in the 3rd reference parameter. The errbuf argument indicates an actual error message in case of failure. PS_FST_TYPE_FIFO procstat_get_vnode_info PS_FST_TYPE_VNODE procstat_get_vnode_info PS_FST_TYPE_SOCKET procstat_get_socket_info PS_FST_TYPE_PIPE procstat_get_pipe_info PS_FST_TYPE_PTS procstat_get_pts_info PS_FST_TYPE_SEM procstat_get_sem_info PS_FST_TYPE_SHM procstat_get_shm_info SEE ALSO
fstat(1), fuser(1), pipe(2), shm_open(2), socket(2), elf(3), kvm(3), queue(3), sem_open(3), sysctl(3), pts(4), core(5), vnode(9) HISTORY
The libprocstat library appeared in FreeBSD 9.0. AUTHORS
The libprocstat library was written by Stanislav Sedov <stas@FreeBSD.org>. This manual page was written by Sergey Kandaurov <pluknet@FreeBSD.org>. BSD
May 3, 2013 BSD
All times are GMT -4. The time now is 04:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy