Sponsored Content
Top Forums Shell Programming and Scripting Finding files with newlines in filename Post 303039185 by Chubler_XL on Wednesday 25th of September 2019 03:51:42 PM
Old 09-25-2019
This is how you use grep:

Code:
$ find . -print0 | grep -z '[\n]'
./file
with
newlines


Last edited by Chubler_XL; 09-25-2019 at 04:57 PM..
These 2 Users Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filename from splitting files to have the same filename of the original file with counter value

Hi all, I have a list of xml file. I need to split the files to a different files when see the <ko> tag. The list of filename are B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml ... (3 Replies)
Discussion started by: natalie23
3 Replies

2. Shell Programming and Scripting

finding files with unicode chars in the filename

I'm trying to check-in a repository to svn -- but the import is failing because some files waaaay down deep in some graphics-library folder are using unicode characters in the file name - which are masked using the ls command but picked up when piping output to more: # ls -l 1914* -rwxrwxr-x 1... (2 Replies)
Discussion started by: mshallop
2 Replies

3. UNIX for Dummies Questions & Answers

finding string in very long file without newlines

What's the best way to find a string in a very long file without newlines in Unix? The standard utility I'm aware of for finding a string in a single file is grep, but for a long file without newlines, I think the output is just going to be the input. I suppose I could use sed to replace the... (5 Replies)
Discussion started by: aaronpoley
5 Replies

4. Shell Programming and Scripting

Finding files with filename format

hi all, i'm trying to find out how to show files having a particular format. i.e. files o570345.out o5703451.out XX_570345_1.RTF so when i search for files using ls *570345* it shows all three files but actually i don't like to see the second file o5703451.out because 5703451 is... (6 Replies)
Discussion started by: adshocker
6 Replies

5. UNIX for Dummies Questions & Answers

finding and moving files based on the last three numerical characters in the filename

Hi, I have a series of files (upwards of 500) the filename format is as follows CC10-1234P1999.WGS84.p190, all in one directory. Now the last three numeric characters, in this case 999, can be anything from 001 to 999. I need to move some of them to a seperate directory, the ones I need to... (5 Replies)
Discussion started by: roche.j.mike
5 Replies

6. Shell Programming and Scripting

Converting space to newlines and renaming files

Hi All, I have this code which has two problems: find . -name '*.fil' | xargs while read page do cat $page | awk '{for(i=1;i<=NF;i++) print $i}' $page>$page.txt done find . -name '*.fil.txt' | xargs rename '.fil.txt' .fil 1. I am running this code in a directory consisting of large... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

7. Shell Programming and Scripting

Finding max number in filename and opening it

Hi, I have files named as energy.dat.1 energy.dat.2 energy.dat.3 ... energy.dat.2342 I would like to find the file with maximum number in the filename (ex. energy.dat.2342) and open it. Would you please share your expertize in writing the script? Thanks in advance. (8 Replies)
Discussion started by: rpd25
8 Replies

8. UNIX for Dummies Questions & Answers

Finding filename based on filecontent

Hi, I have been trying , to find the filename based on some pattern present inside the file My command is as follows: filename=`grep -l 'Pattern' path/*.txt ` Its strange that it works some times, but doesn't print anything some times . But my if test -f $filename is passing all the... (2 Replies)
Discussion started by: Prashanth19
2 Replies

9. Shell Programming and Scripting

Merging data horizontally with newlines in files

Hi Everyone, I have two files file1 and file2 with these contents cat file1 AAAAA 01/03/2014 04:01:23 BBBB 01/03/2014 03:03:34 CCCcc 01/03/2014 03:03:34 cat file2 1 RED 1 HHHH 1 TTTT 1 BBBBB I tried the below... (2 Replies)
Discussion started by: Aditya_001
2 Replies

10. Shell Programming and Scripting

Finding the part of a filename

Hi, I am writing an ebuild for Gentoo Linux operating system. Writing an ebuild is about Bash scripting where I am a newbie. So, my ebuild must find a part of a specific filename. Such a filaname my look like this: libvclient_release_x64.so.740and I must to find the number at the and of... (18 Replies)
Discussion started by: csanyipal
18 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 04:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy