Sponsored Content
Top Forums Shell Programming and Scripting bash script working for small size files but not for big size files. Post 302094825 by Corona688 on Wednesday 1st of November 2006 10:06:15 AM
Old 11-01-2006
code tags for code please. It makes code readable. Like {code} stuff {/code} except with [ ] instead of { }.

I take it $1 is the stat file? What is the a=`cat $1` bit for? $a isn't even used anywhere else.

If $a is used anywhere else, this'd be the weak point. Shell variables have size limits. Use pipes instead.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

shell script to find files by date and size

Hi, I have a directory PRIVATE in which I have several directories and each of these have several files. Therefore, I need to find those files by size and date to back up those files in another directory. I don't know how to implement this shell script using ''find''. appreciate any... (1 Reply)
Discussion started by: dadadc
1 Replies

2. Shell Programming and Scripting

This script cut size of files "Lol" change string in files

Basic: find . -type f -name “*.txt” -print | awk '{gsub("Ontem", "AntesdeOntem", $0); print > FILENAME}' *.txt The idea is in folder /home/myapontamentos I have some files and i need to change in all them the word "ontem" to "antesdeontem". But bigger files are cut (size i mean)... (4 Replies)
Discussion started by: single
4 Replies

3. Shell Programming and Scripting

Merge files of differrent size with one field common in both files using awk

hi, i am facing a problem in merging two files using awk, the problem is as stated below, file1: A|B|C|D|E|F|G|H|I|1 M|N|O|P|Q|R|S|T|U|2 AA|BB|CC|DD|EE|FF|GG|HH|II|1 .... .... .... file2 : 1|Mn|op|qr (2 Replies)
Discussion started by: shashi1982
2 Replies

4. Shell Programming and Scripting

Comparing same size of files using KSH script

Hi, I have a requirement I have to find out the same size of files with different name in a particular directory. For ex: I have around 1 lack records in a directory and in that I have abcd.jpg, abcd_1.jpg with same size each. I need to seperate these two records from that file.... (3 Replies)
Discussion started by: siri_886
3 Replies

5. Shell Programming and Scripting

Shell script to calculate the size of files

Dear all, Please help me to write a script that can calculate the size of files. For example: I have a directory which contain thousands of files. I need to know the size of files that their name begin with abc_123 Thank all!! (4 Replies)
Discussion started by: hainguyen1402
4 Replies

6. Shell Programming and Scripting

How to delete some of the files in the directory, if the directory size limits the specified size

To find the whole size of a particular directory i use "du -sk /dirname".. but after finding the direcory's size how do i make conditions like if the size of the dir is more than 1 GB i hav to delete some of the files inside the dir (0 Replies)
Discussion started by: shaal89
0 Replies

7. Emergency UNIX and Linux Support

Script to fill the file system mount with empty files to desired size

We are regularly using for our testing, where we are manually filling up the mount with desired size with following command dd if=/dev/zero of=file_2GB bs=2048000 count=2000 We are planning to automate the task where taking input for % of size as one input and the name of the file system... (8 Replies)
Discussion started by: chandu123
8 Replies

8. Shell Programming and Scripting

Help in Shell script to report size of files=0

Hello, I am trying to write a shell script in unix which looks for the last two files in a folder, checks their size and reports(via mail) if either of their file size is =0. cd /tmp list last two files: ls -ltr | tail -2 check if size of any of these two files is 0 if true, then send a... (8 Replies)
Discussion started by: kiran1112
8 Replies

9. Red Hat

Du -sh command taking time to calculate the big size files

Hi , My linux server is taking more time to calculate big size from long time. * i am accessing server through ssh * commands # - du -sh * #du -sh * | sort -n | grep G Please guide me for fast way to find big size directories under to / partition Thanks (8 Replies)
Discussion started by: Nats
8 Replies

10. UNIX for Beginners Questions & Answers

Help with Expect script for pulling log files size larger than 500Mb;

I am new at developing EXPECT scripts. I'm trying to create a script that will automatically connect to a several UNIX (sun solaris and HPUX) database server via FTP and pull the sizes of the listener/alert log files from specified server directory on the remote machines. 1. I want the script... (7 Replies)
Discussion started by: mikebantor
7 Replies
DOCHECKGROUPS(8)					    InterNetNews Documentation						  DOCHECKGROUPS(8)

NAME
docheckgroups - Process checkgroups and output a list of changes SYNOPSIS
docheckgroups [-u] [include-pattern [exclude-pattern]] DESCRIPTION
docheckgroups is usually run by controlchan in order to process checkgroups control messages. It reads a list of newsgroups along with their descriptions on its standard input. That list should be formatted like the newsgroups(5) file: each line contains the name of a newsgroup followed by one or more tabulations and its description. docheckgroups will only check the presence of newsgroups which match include-pattern (an egrep expression like "^comp..*$" for newsgroups starting with "comp.") and which do not match exclude-pattern (also an egrep expression) except for newsgroups mentioned in the pathetc/localgroups file. This file is also formatted like the newsgroups(5) file and should contain local newsgroups which would otherwise be mentioned for removal. There is no need to put local newsgroups of hierarchies for which no checkgroups control messages are sent, unless you manually process checkgroups texts for them. Lines beginning with a hash sign ("#") are not taken into account in this file. All the newsgroups and descriptions mentioned in pathetc/localgroups are appended to the processed checkgroups. If exclude-pattern is given, include-pattern should also be given before (you can use an empty string ("") if you want to include all the newsgroups). Be that as it may, docheckgroups will only check newsgroups in the top-level hierarchies which are present in the checkgroups. Then, docheckgroups checks the active and newsgroups files and displays on its standard output a list of changes, if any. It does not change anything by default; it only points out what should be changed: o Newsgroups which should be removed (they are in the active file but not in the checkgroups) and the relevant ctlinnd commands to achieve that; o Newsgroups which should be added (they are not in the active file but in the checkgroups) and the relevant ctlinnd commands to achieve that; o Newsgroups which are incorrectly marked as moderated or unmoderated (they are both in the active file and the checkgroups but their status differs) and the relevant ctlinnd commands to fix that; o Descriptions which should be removed (they are in the newsgroups file but not in the checkgroups); o Descriptions which should be added (they are not in the newsgroups file but in the checkgroups). The output of docheckgroups can be fed into mod-active (it will pause the news server, update the active file accordingly, reload it and resume the work of the news server) or into the shell (commands for ctlinnd will be processed one by one). In order to update the newsgroups file, the -u flag must be given to docheckgroups. When processing a checkgroups manually, it is always advisable to first check the raw output of docheckgroups. Then, if everything looks fine, use mod-active and the -u flag. OPTIONS
-u If this flag is given, docheckgroups will update the newsgroups file: it removes obsolete descriptions and adds new ones. It also sorts this file alphabetically and improves its general format (see newsgroups(5) for an explanation of the preferred number of tabulations). EXAMPLES
So as to better understand how docheckgroups works, here are examples with the following active file: a.first 0000000000 0000000001 y a.second.announce 0000000000 0000000001 y a.second.group 0000000000 0000000001 y b.additional 0000000000 0000000001 y b.third 0000000000 0000000001 y c.fourth 0000000000 0000000001 y the following newsgroups file (using tabulations): a.first First group. a.second.announce Announce group. a.second.group Second group. b.third Third group. c.fourth Fourth group. and the following localgroups file (using tabulations): b.additional A local newsgroup I want to keep. The checkgroups we process is in the file test which contains: a.first First group. a.second.announce Announce group. (Moderated) a.second.group Second group. b.third Third group. c.fourth Fourth group. If we run: cat test | docheckgroups docheckgroups will output that a.second.announce is incorrectly marked as unmoderated and that its description is obsolete. Besides, two new descriptions will be mentioned for addition (the new one for a.second.announce and the missing description for b.additional -- it should indeed be in the newsgroups file and not only in localgroups). Now that we have checked the output of docheckgroups and that we agree with the changes, we run it with the -u flag to update the newsgroups file and we redirect the standard output to mod-active to update the active file: cat test | docheckgroups -u | mod-active That's all! Now, suppose we run: cat test | docheckgroups "^c..*$" Nothing is output (indeed, everything is fine for the c.* hierarchy). It would have been similar if the test file had only contained the checkgroups for the c.* hierarchy (docheckgroups would not have checked a.* and b.*, even if they had been in include-pattern). In order to check both a.* and c.*, you can run: cat test | docheckgroups "^a..*$|^c..*$" And if you want to check a.* but not a.second.*, you can run: cat test | docheckgroups "^a..*$" "^a.second..*$" In our example, docheckgroups will then mention a.second.announce and a.second.group for removal since they are in the active file (the same goes for their descriptions). Notwithstanding, if you do want to keep a.second.announce, just add this group to localgroups and docheckgroups will no longer mention it for removal. FILES
pathbin/docheckgroups The Shell script itself used to process checkgroups. pathetc/localgroups The list of local newsgroups along with their descriptions. HISTORY
Documentation written by Julien Elie for InterNetNews. $Id: docheckgroups.pod 8357 2009-02-27 17:56:00Z iulius $ SEE ALSO
active(5), controlchan(8), ctlinnd(8), mod-active(8), newsgroups(5). INN 2.5.2 2009-05-21 DOCHECKGROUPS(8)
All times are GMT -4. The time now is 01:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy