Sponsored Content
Full Discussion: File with no name
Operating Systems Solaris File with no name Post 90555 by zazzybob on Wednesday 23rd of November 2005 05:30:52 PM
Old 11-23-2005
If it is a file that is called ' ', i.e. a single space, you can delete it a couple of ways....

Code:
$ touch \
$ ls -la
total 4
-rw-rw-r--   1 foo    bar            0 Nov 24 11:26
drwxrwxr-x   2 foo    bar          512 Nov 24 11:26 .
drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..
$ rm ' '
$ ls -la
total 4
drwxrwxr-x   2 foo    bar          512 Nov 24 11:26 .
drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..
$ touch \
$ ls -la
total 4
-rw-rw-r--   1 foo    bar            0 Nov 24 11:26
drwxrwxr-x   2 foo    bar          512 Nov 24 11:26 .
drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..
$ ls -lia
total 4
       320 -rw-rw-r--   1 foo    bar            0 Nov 24 11:26
       319 drwxrwxr-x   2 foo    bar          512 Nov 24 11:26 .
         6 drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..
$ find . -inum 320 -exec rm {} \;
$ ls -la
total 4
drwxrwxr-x   2 foo   bar          512 Nov 24 11:26 .
drwxr-xr-x  10 foo   bar         1024 Nov 24 11:25 ..

Also, it might actually be some kind of control character... observe...
Code:
$ touch ^G
$ ls -la
total 4
-rw-rw-r--   1 foo    bar            0 Nov 24 11:27
drwxrwxr-x   2 foo    bar          512 Nov 24 11:27 .
drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..
$ ls -lba
total 4
-rw-rw-r--   1 foo    bar            0 Nov 24 11:27 \007
drwxrwxr-x   2 foo    bar          512 Nov 24 11:27 .
drwxr-xr-x  10 foo    bar         1024 Nov 24 11:25 ..

Cheers
ZB
 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

2. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

3. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
Text::Glob(3)						User Contributed Perl Documentation					     Text::Glob(3)

NAME
Text::Glob - match globbing patterns against text SYNOPSIS
use Text::Glob qw( match_glob glob_to_regex ); print "matched " if match_glob( "foo.*", "foo.bar" ); # prints foo.bar and foo.baz my $regex = glob_to_regex( "foo.*" ); for ( qw( foo.bar foo.baz foo bar ) ) { print "matched: $_ " if /$regex/; } DESCRIPTION
Text::Glob implements glob(3) style matching that can be used to match against text, rather than fetching names from a filesystem. If you want to do full file globbing use the File::Glob module instead. Routines match_glob( $glob, @things_to_test ) Returns the list of things which match the glob from the source list. glob_to_regex( $glob ) Returns a compiled regex which is the equivalent of the globbing pattern. glob_to_regex_string( $glob ) Returns a regex string which is the equivalent of the globbing pattern. SYNTAX
The following metacharacters and rules are respected. "*" - match zero or more characters "a*" matches "a", "aa", "aaaa" and many many more. "?" - match exactly one character "a?" matches "aa", but not "a", or "aaa" Character sets/ranges "example.[ch]" matches "example.c" and "example.h" "demo.[a-c]" matches "demo.a", "demo.b", and "demo.c" alternation "example.{foo,bar,baz}" matches "example.foo", "example.bar", and "example.baz" leading . must be explictly matched "*.foo" does not match ".bar.foo". For this you must either specify the leading . in the glob pattern (".*.foo"), or set $Text::Glob::strict_leading_dot to a false value while compiling the regex. "*" and "?" do not match / "*.foo" does not match "bar/baz.foo". For this you must either explicitly match the / in the glob ("*/*.foo"), or set $Text::Glob::strict_wildcard_slash to a false value with compiling the regex. BUGS
The code uses qr// to produce compiled regexes, therefore this module requires perl version 5.005_03 or newer. AUTHOR
Richard Clamp <richardc@unixbeard.net> COPYRIGHT
Copyright (C) 2002, 2003, 2006, 2007 Richard Clamp. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
File::Glob, glob(3) perl v5.18.2 2017-10-06 Text::Glob(3)
All times are GMT -4. The time now is 07:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy