logo
down
shadow

Linux : Remove/Delete .txt files ending with exactly five digits


Linux : Remove/Delete .txt files ending with exactly five digits

By : user2949914
Date : November 17 2020, 04:28 AM
I hope this helps . This cmd finds and rm's files with the filename pattern [any number of digits].txt in linux:
code :
find /path/to/search -type f -regextype posix-extended -regex '^.*/[0-9]+\.txt' -exec rm -f {} \;
find /path/to/search -type f -regextype posix-extended -regex '^.*/[0-9]{10}\.txt' -exec rm -f {} \;


Share : facebook icon twitter icon
Remove duplicated files in linux fs with ending e+$

Remove duplicated files in linux fs with ending e+$


By : sameer
Date : March 29 2020, 07:55 AM
I wish this help you first I assume you have a list of all files in your directory. It could be a plain text file. let's call it list
then this one-liner will do the job:
code :
sort list|awk '{if(p&&$0~p"e+$")print "rm "$0;p=$0}'
kent$  cat list
index.html
logo.png
logo.pnge
package.zip
index.htmle
index.htmlee
package.zipe
file.exe
file.exee
file.exeee

kent$  sort list|awk '{if(p&&$0~p"e+$")print "rm "$0;p=$0}' 
rm file.exee
rm file.exeee
rm index.htmle
rm index.htmlee
rm logo.pnge
rm package.zipe
sort list|awk '{if(p&&$0~p"e+$")print "rm "$0;p=$0}'|sh
sort list|awk '{if(p&&$0~p"e+$")print "rm \""$0"\"";p=$0}'
ignore files ending with numbers with 0-3 digits

ignore files ending with numbers with 0-3 digits


By : user3175465
Date : March 29 2020, 07:55 AM
this one helps. Gitignore takes it's syntax from fnmatch/glob, which is specified in man glob(7).
There doesn't seem to be a way to indicate a certain number of characters need to be matched, like you could with the regular expression dsmodelext[0-9]{0,3}.c
Deleting files ending with 2 digits in linux

Deleting files ending with 2 digits in linux


By : Nayra
Date : March 29 2020, 07:55 AM
Any of those help Converting comments into an answer.
Your requirement is a bit ambiguous. However, you can use:
code :
rm -i *[0-9][0-9]
rm -i *[!0-9][0-9][0-9]
rm -i [0-9][0-9]
echo *[!0-9][0-9]
printf '%s\n' *[!0-9][0-9]
Remove digits from string which is ending by digits

Remove digits from string which is ending by digits


By : Mattunit117
Date : March 29 2020, 07:55 AM
wish of those help You can try this solution, I used this many times.
Create a function from given code.
code :
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  CREATE FUNCTION [dbo].[RemoveSpecialChars] (@s VARCHAR(2000)) RETURNS VARCHAR(2000)
     WITH SCHEMABINDING
  BEGIN
     IF @s IS NULL
        RETURN NULL
     DECLARE @s2 VARCHAR(256)
     SET @s2 = ''
     DECLARE @l INT
     SET @l = LEN(@s)
     DECLARE @p int
     SET @p = 1
     WHILE @p <= @l BEGIN
        DECLARE @c INT
        SET @c = ASCII(SUBSTRING(@s, @p, 1))
        IF @c BETWEEN 65 AND 90 OR @c BETWEEN 97 AND 122 OR @c = 64 OR @c = 46
           SET @s2 = @s2 + CHAR(@c)
        SET @p = @p + 1
        END
     IF LEN(@s2) = 0
        RETURN NULL
     RETURN @s2
  END
    UPDATE [dbo].[Email]
    SET Email = AA.Email    
    FROM [dbo].[Email] AEL
    CROSS APPLY
    (SELECT TOP 1 [dbo].[RemoveSpecialChars](Email)AS Email FROM [dbo].[Email] at WHERE at.Email=AEL.Email) AA
linux bash - compare two files and remove duplicate lines having same ending

linux bash - compare two files and remove duplicate lines having same ending


By : Aurélien Petitfrère
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I have two files containing paths to files. , This awk command should do the job:
code :
awk -F/ 'NR == FNR{a[$NF]=$0; next} !($NF in a); END{for (i in a) print a[i]}' file2 file1

/home/anybody/proj1/hello.h
/home/anybody/proj1/car.h
/home/anybody/proj2/module/include/map.h
/home/anybody/proj2/module/include/cat.h
/home/anybody/proj2/module/include/engine.h
/home/anybody/proj2/module/include/tree.h
/home/anybody/proj2/module/include/sun.h
Related Posts Related Posts :
  • What does it mean by code holding semaphore can be preempted
  • Does LD_LIBRARY_PATH really cause inconsistencies?
  • "lsof" shows a file as (deleted) but I can still see it in file system
  • Linux file deleted recovery
  • Exchange columns in bash
  • How to set max file size in Linux CeNTOS to server.log
  • Regular expressions: Search a word and append a new word at the end of the line
  • Compress a set of log files in a folder depending on number of files
  • unexpected behavior of linux malloc
  • relation between init and bash terminal process
  • Matlab VideoReader codec error?
  • How to catch the L3-cache hits and misses by perf tool in Linux
  • Executable Deleting Itself on linux
  • How to change the apache httpd port for serving files
  • Installing Patches in linux
  • Comparative analysis between libkvm on linux and NetBSD
  • How to join multiple txt files into based on column?
  • setting LINK variable in Makefile generated by qmake (5.0)
  • Automake - difficulty with installing version 'automake-1.14.1'
  • How to use Linux Network Namespaces for per processes routing?
  • How can I write a Gruntfile with different shell command behaviour for OS X vs. Linux?
  • Using at command in shell script for scheduling a command
  • Is there a method to figure out the audio channel layout in Linux?
  • Setting environment varilable for daemon / root process
  • string replacement in shell script
  • Add specific column to the end of a CSV file
  • Are there programmable automount/autofs hooks in linux/systemd?
  • Renaming files like 20141207_190822.jpg to "2014-12-07 19.08.22.jpg" in linux or MacOS X
  • undocumented kernel boot parameter?
  • using wget to mirror a website with path and subfolder that have the same name
  • Using awk to find data matching date range in text file
  • Installing xorg-x11-devel package in SLES 11 SP2
  • Setting result of find to variable, which has variables within it
  • Maximum/Minimum physical address - Linux kernel
  • Freepbx custom context outbound route
  • memcpy implementation in linux kernel
  • How to reverse a list of words in a shell string?
  • Concatenate and pass as parameter in bash
  • Add user to Docker container
  • How to add a content in a file in linux without opening the file using vi or cat command
  • Which SVN subversion can I use on linux, Mac, Windows?
  • Work with ZIP archive at Bash
  • bash script not running as expected from cron vs. shell.
  • Compare one field, Remove duplicate if value of another field is greater
  • sudoers NOPASSWD: sudo: no tty present and no askpass program specified
  • How do I use pipes and variable substitution in a shell script (for toggling haproxy active server)?
  • Linux/Unix Find Command
  • Not able to copy data in hdfs with hdfs dfs commands
  • ARM assembly "retne" instruction
  • Migrate from LXC to LXD
  • sbt on linux not accepting -jvm-debug 5005
  • Supervisord events only sent to one eventlistener in pool
  • Finding all .c files in linux using grep
  • Extract part of a file name in bash
  • Bash Script to Comment/uncomment lines in file
  • Linux audio control web alsamixer
  • Can't remove first two encode characters using text editors in linux
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org