Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Move a TXT file greater or equal 355 MB with its corresponding .LST file Post 303043375 by alexcol on Monday 27th of January 2020 02:24:31 AM
Old 01-27-2020
One final question please:
Script did what is supposed to do but I came up a question related what you mentioned previusly:
Compare this loop with the other loop where condition is always true so it never ends

So this script is supposed to end when the condition is true?
I run the scrpt but never ended

Code:
#!/bin/bash
while true
do
 # find big .TXT files
 find . ! -name . -prune -name 'NS6142*.TXT' -size +355000000c -print |
 # raw-read the filenames from the pipe
 while IFS= read -r fn
 do
  # strip .TXT and add .LST
  fn2=${fn%.TXT}.LST
  # move both files to target_dir
  mv "$fn" "$fn2" ./pruebas/
 done
 sleep 120 
done

Output:

Code:
/produccion/explotacion/xptol/tel/tasacion/RECEP/CENTRAL_142_24012020/pruebas # ls -lrth
total 2909256
-rw-r--r--   1 xptol    explotacion    355M Jan 24 15:40 NS6142SCA20200124152445.TXT
-rw-r--r--   1 xptol    explotacion       7 Jan 24 15:40 NS6142SCA20200124152445.LST
-rw-r--r--   1 xptol    explotacion    355M Jan 24 16:48 NS6142SCA20200124163227.TXT
-rw-r--r--   1 xptol    explotacion       7 Jan 24 16:48 NS6142SCA20200124163227.LST
-rw-r--r--   1 xptol    explotacion    355M Jan 25 01:27 NS6142SCA20200125011130.TXT
-rw-r--r--   1 xptol    explotacion       7 Jan 25 01:27 NS6142SCA20200125011130.LST
-rw-r--r--   1 xptol    explotacion    355M Jan 25 10:39 NS6142SCA20200125102126.TXT
-rw-r--r--   1 xptol    explotacion       7 Jan 25 10:39 NS6142SCA20200125102126.LST

source directory:
Code:
/produccion/explotacion/xptol/tel/tasacion/RECEP/CENTRAL_142_24012020 # ls -lrt|head
total 4249458
-rw-r--r--   1 xptol    explotacion 41016367 Jan 24 14:44 NS6142SCA20200124143011.TXT.gz
-rw-r--r--   1 xptol    explotacion      55 Jan 24 14:44 NS6142SCA20200124143011.LST.gz
-rw-r--r--   1 xptol    explotacion 41016367 Jan 24 15:02 NS6142SCA20200124144828.TXT.gz
-rw-r--r--   1 xptol    explotacion      55 Jan 24 15:02 NS6142SCA20200124144828.LST.gz
-rw-r--r--   1 xptol    explotacion 41016367 Jan 24 15:20 NS6142SCA20200124150634.TXT.gz
-rw-r--r--   1 xptol    explotacion      55 Jan 24 15:20 NS6142SCA20200124150634.LST.gz
-rw-r--r--   1 xptol    explotacion 41016367 Jan 24 16:01 NS6142SCA20200124154443.TXT.gz
-rw-r--r--   1 xptol    explotacion      55 Jan 24 16:01 NS6142SCA20200124154443.LST.gz
-rw-r--r--   1 xptol    explotacion 41016367 Jan 24 17:08 NS6142SCA20200124165229.TXT.gz
/produccion/explotacion/xptol/tel/tasacion/RECEP/CENTRAL_142_24012020 # 
/produccion/explotacion/xptol/tel/tasacion/RECEP/CENTRAL_142_24012020 # ls -lrt|tail
-rw-r--r--   1 xptol    explotacion 41016367 Jan 25 09:56 NS6142SCA20200125093943.TXT.gz
-rw-r--r--   1 xptol    explotacion      55 Jan 25 09:56 NS6142SCA20200125093943.LST.gz
-rw-r--r--   1 xptol    explotacion 41016367 Jan 25 10:16 NS6142SCA20200125100137.TXT.gz
-rw-r--r--   1 xptol    explotacion      55 Jan 25 10:16 NS6142SCA20200125100137.LST.gz
-rw-r--r--   1 xptol    explotacion 41016367 Jan 25 10:59 NS6142SCA20200125104305.TXT.gz
-rw-r--r--   1 xptol    explotacion      55 Jan 25 10:59 NS6142SCA20200125104305.LST.gz
-rw-r--r--   1 xptol    explotacion   10213 Jan 26 23:49 ejemplo.txt
-rwxr-xr-x   1 xptol    explotacion     457 Jan 27 01:39 script1.sh
-rwxr-xr-x   1 xptol    explotacion     488 Jan 27 02:00 script.sh
drwxr-sr-x   2 xptol    explotacion     512 Jan 27 02:01 pruebas/

Thans for your help in advanced
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl how to move pointer to previous line in a txt file?

I have a text file that has blocks of text. Each block starts with ### and ends with End_###. I wrote a perl script to search a string from line 2 (ignore any line starts with ###) of each block if matched, need to print that whole block. According to the input file in below, it will print... (5 Replies)
Discussion started by: tqlam
5 Replies

2. UNIX for Dummies Questions & Answers

Binary txt file received when i use uuencode to send txt file as attachment

Hi, I have already read a lot of posts on sending attachments in unix...but none of them were of help for my problem...so here goes.. i wanna attach a text file and send to a mail id..used the following code : uuencode "$File1" "$File1" ;|mail -s "$Mail_sub" abc@abc.com it works... (2 Replies)
Discussion started by: ash22
2 Replies

3. Shell Programming and Scripting

Trying to find files equal to and greater than

Hi Guys and Gals, I'm having some difficulty putting this check into a shell script. I would like to search a particular directory for a number of files. The logic I have is pretty simple: Find file named *.txt that are newer than <this file> and count them If the number of files is equal to... (4 Replies)
Discussion started by: bbbngowc
4 Replies

4. Shell Programming and Scripting

Problem with Greater Than Or Equal To

BASH problem with IS GREATER THAN OR EQUAL TO. I have tried a dozen variations for this IF statement to work with IS GREATER THAN OR EQUAL TO. My code below WORKS. array=( $( /usr/bin/sar -q 1 30 |grep Average |awk '{print $2,$3}' ) ) nthreads="${array}" avproc="${array}" if && ; then ... (6 Replies)
Discussion started by: diex
6 Replies

5. Shell Programming and Scripting

Move txt file to with current date appended to filename

I have multiple txt files which begin with the word "orders" in folder C:\source. I need to move the files to folder C:\dest and rename them to "process_<date>_<count>" So for example , if there are 3 files ordersa.txt , ordersb.txt and ordersc.txt in C:\source , after running the script I want... (1 Reply)
Discussion started by: johannd
1 Replies

6. UNIX for Dummies Questions & Answers

Move txt file to with current date appended to filename

I have multiple txt files which begin with the word "orders" in folder C:\source. I need to move the files to folder C:\dest and rename them to "process_<date>_<count>" So for example , if there are 3 files ordersa.txt , ordersb.txt and ordersc.txt in C:\source , after running the script I want... (7 Replies)
Discussion started by: johannd
7 Replies

7. UNIX for Dummies Questions & Answers

Missing menu.lst file in Ubuntu

I am not able to find menu.lst in /boot. During the Linux Kernel Compilation I installed the kernel using make install. Next I created an initrd image. I had to modify the Grub configuration file - /boot/grub/menu.lst which I am not able to find. Any resolution for the issue? (3 Replies)
Discussion started by: rupeshkp728
3 Replies

8. UNIX for Dummies Questions & Answers

look for file size greater than "0" of specific pattern and move those to another directory

Hi , i have some files of specific pattern ...i need to look for files which are having size greater than zero and move those files to another directory.. Ex... abc_0702, abc_0709, abc_782 abc_1234 ...etc need to find out which is having the size >0 and move those to target directory..... (7 Replies)
Discussion started by: dssyadav
7 Replies

9. Windows & DOS: Issues & Discussions

2 Questions: replace text in txt file, add text to end of txt file

so... Lets assume I have a text file. The text file contains multiple "#" symbols. I want to replace all thos "#"s with a STRING using DOS/Batch I want to add a certain TEXT to the end of each line. How can I do this WITHOUT aid of sed, grep or anything linux related ? (1 Reply)
Discussion started by: pasc
1 Replies

10. UNIX for Beginners Questions & Answers

Compare first column from two csv files with greater than or equal, and less than

I have two csv files of different sizes. The output file needs to have file1 contents on top of file2 contents where file2 col1 is >= to file1 col1, and file2 col1(same value) is < file1 col1 (next value). So basically, some file2 rows will be matched to the same file1 row because it is the closet... (7 Replies)
Discussion started by: aachave1
7 Replies
DBS-EDIT-PATCH(1)						Debian Build System						 DBS-EDIT-PATCH(1)

NAME
dbs-edit-patch - Edit a DBS patch SYNOPSIS
dbs-edit-patch [options] patch dbs-edit-patch -h|--help DESCRIPTION
dbs-edit-patch is script to generate or modify patches for Debian source-packages in DBS format. WARNING
dbs is deprecated, please switch to the `3.0 (quilt)' Debian source package format instead. See http://wiki.debian.org/Projects/Deb- Src3.0#FAQ for a short guide how to do it. OPTIONS
-h, --help Show summary of options. -t dir, --tmpdir=dir Directory for the temporary files, default is /tmp or if set $TMP. -s dir, --sourcedir=dir Top level directory of the debian-package source-tree, default is the present working directory. -P dir, --sourcepatchdir=dir Directory containing upstream patches. -T dir, --sourcetardir=dir Directory containing the upstream tarball. -p level, --strip=level Striplevel -p of patch (Option -p of diff(1)), accepted values are 0 and 1, default is 0. ENVIRONMENT VARIABLES
TMP Sets the directory for the temporary files, can be overridden with -t dir. debian/vars dbs-edit-patch will automatically use variables defined in the optional debian/vars file. When a file debian/vars.in exists and debian/vars either does not exist or is older than any of the following files: debian/vars.in, debian/changelog, debian/rules or debian/control, then dbs-edit-patch will try updating the vars file by running the following command make -f debian/rules -W debian/vars.in debian/vars EXAMPLES
Edit the 021_debian patch of Heimdal: ~/heimdal-0.3d> dbs-edit-patch -t/tmp 021_debian Extracting source heimdal-0.3d.tar.gz ... successful. Applying patch 001_replay ... successful. etc. Copying heimdal-0.3d to heimdal-0.3d-old ... successful. Applying patch 021_debian ... successful. Edit files under /tmp/021_debian/heimdal-0.3d as required, then put a short description into /tmp/021_debian/patch-description if desired, and finally execute /tmp/021_debian/dbs-update-patch to save the results. Technical note: dbs-edit-patch extracts all patches before 021_debian into /tmp/021_debian/heimdal-0.3d, copies the result to /tmp/021_debian/heimdal-0.3d-old, and applies the last patch 021_debian (if it exists). Also, it creates a shell script which will create the diff between the old and new directories: ~/heimdal-0.3d> ls -la /tmp/021_debian total 12 -rwxr-xr-x 1 bam users 112 Jan 31 13:31 dbs-update-patch* -rw-r--r-- 1 bam users 0 Jan 31 13:31 patch-description drwxr-xr-x 14 bam users 4096 Jan 31 13:31 heimdal-0.3d/ drwxr-xr-x 14 bam users 4096 Jan 31 13:31 heimdal-0.3d-old/ drwxr-xr-x 5 bam users 4096 Jan 31 13:31 .stampdir/ ~/heimdal-0.3d> cat /tmp/021_debian/dbs-update-patch #!/bin/sh -e cd "/tmp/021_debian" HOOK_DIR="/usr/src/heimdal/debian/dbs-hooks" test -d "$HOOK_DIR" && run-parts "$HOOK_DIR" --arg update-patch-prediff find -name "*.bak" -print0 | xargs -0 --no-run-if-empty rm find -name "*~" -print0 | xargs -0 --no-run-if-empty rm : > new_patch test ! -e patch-description || cp patch-description new_patch diff -ruN heimdal-0.3d-old heimdal-0.3d >> new_patch || test $? -eq 1 mv new_patch /usr/src/heimdal/debian/patches/021_debian test -d "$HOOK_DIR" && run-parts "$HOOK_DIR" --arg update-patch-postdiff SEE ALSO
diff(1), dbs(7), /usr/share/doc/dbs/ AUTHOR
DBS was written by Adam Heath, modified by Ben Collins, modified and packaged for Debian by Brian May. This manpage was generated by Andreas Metzler and modified by Robert Luberda. Debian February 15th, 2011 DBS-EDIT-PATCH(1)
All times are GMT -4. The time now is 03:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy