how do I identify files with characters beyond a certain range.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how do I identify files with characters beyond a certain range.
# 1  
Old 02-14-2008
Data how do I identify files with characters beyond a certain range.

I have a directory with hundreds of files that can not have data pass column 80. I do not know of way to combine "grep" and "cut" command.

I tried:
cat * | cut -c 81-120 |pg
but it only shows me the line, not the file name.

Any help would be appreciated. Been on this all day.
# 2  
Old 02-14-2008
grep -l "^.\{81\}$" *

81 is used because you are serching for files which contain at least 1 line with 81 or more characters.
# 3  
Old 02-14-2008
That worked !!!!

I think I was over engineering it all day today. Thanks. I'd buy you a beer if I could.
# 4  
Old 02-14-2008
I prefer vodka.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regex to identify illegal characters in a perso-arabic database

I am working on Sindhi: a perso-Arabic script and since it shares the Unicode-block with over 400 other languages, quite often the database contains characters which are not wanted: illegal characters. I have identified the character set of Sindhi which is given below: For clarity's sake, each... (8 Replies)
Discussion started by: gimley
8 Replies

2. Shell Programming and Scripting

Unable to identify the special characters beyond the range of "[\x80-\xFF]"

I want to filter out the special character whose ascii value doesn't fall within the range "" . Example:� or Ć. So in that case is there any defined range which will filter out this characters. I can filter those which falls withing "" . Need to filter those special chracter which doesn't... (14 Replies)
Discussion started by: Abhijit Sen
14 Replies

3. Shell Programming and Scripting

Identify extended ascii characters in a file

Hi, Is there a way to identify the lines in a file having extended ascii characters and display the same? For instance I have a file abc.txt having below data aaa|bbb|111|This is first line aaa|bbb|222|This is secõnd line aaa|bbb|333|This is third line aaa|bbb|444|This is foùrth line... (3 Replies)
Discussion started by: decci_7
3 Replies

4. UNIX for Dummies Questions & Answers

Extracting range of characters if pattern matches

Im trying compare values between files and if they match I want to extract some characters in between those values for many files. They are in two directories and have the name filename but one ends in .enr. They look like this. cat bat.1.enr name,start,end bat.1,231, 234 and another... (5 Replies)
Discussion started by: verse123
5 Replies

5. Shell Programming and Scripting

sed replace range of characters in each line

Hi, I'm trying to replace a range of characters by their position in each line by spaces. I need to replace characters 95 to 145 by spaces in each line. i tried below but it doesn't work sed -r "s/^(.{94})(.{51})/\ /" inputfile.txt > outputfile.txt can someone please help me... (3 Replies)
Discussion started by: Kevin Tivoli
3 Replies

6. UNIX for Dummies Questions & Answers

How to specify beginning-of-line/end-of-line characters inside a regex range

How can I specify special meaning characters like ^ or $ inside a regex range. e.g Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character. I tried the following but it does not work: sed 's/\(\)/<do something here>/g' file1 ... (3 Replies)
Discussion started by: jawsnnn
3 Replies

7. Shell Programming and Scripting

removing a range of characters in a filename

hi, I have quite a bunch of files with annoyingly long filenames. I wanted to cut the range of characters from 9-18 and just retain the first 8 characters and the .extension. any suggestion how to do it. thanks much. original filename: 20000105_20000105_20100503.nc.asc output filename:... (4 Replies)
Discussion started by: ida1215
4 Replies

8. Shell Programming and Scripting

Need help to identify files

Hi, I have one problem. I want to identify all those files which are named according to the format <name>_<date>. I have tried using awk and grep in bash but i m not able to get it correct. Can someone please help? It's urgent !! (10 Replies)
Discussion started by: udayan_goswami
10 Replies

9. UNIX for Dummies Questions & Answers

Identify File with ControlM Characters

Dear Members, I have a file which contains ControlM characters in it. I need a command by the means of which i should be able to identify if a file has controlM characters. How can this be achieved. Thanks Sandeep (4 Replies)
Discussion started by: sandeep_1105
4 Replies

10. Shell Programming and Scripting

Identify records having junk characters in unix

Hi Friends, I need to have a command in Unix which output all teh records havingg junk characters in a file.... I know a command cat -tv <Filename> which opens the file and we can check for any junk character in it. But my requirement is to fetch ONLY THOSE records having junk characters.... (6 Replies)
Discussion started by: sureshg_sampat
6 Replies
Login or Register to Ask a Question