Cannot open txt file in UNIX using cat utility


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cannot open txt file in UNIX using cat utility
# 1  
Old 11-28-2012
Cannot open txt file in UNIX using cat utility

Hi,

I am not being able to open txt files with 'cat'. One thing to mention is, the filenames start with #. I guess one can have a unix filename that starts with a special/wildcard character. I have filenames starting with @ [like @filename] and they are opening perfectly with cat.
# 2  
Old 11-28-2012
# generally used for comments in shell so it assumes that string after # as a comment.

you may try

Code:
cat "#file_n"
sdfd

cat #file_n here file_n is a comment as per the shell..Smilie
# 3  
Old 11-28-2012
I am not able to create a file with # in start of the name on ubuntu.
Can you rename it, or make the source program create files that do not start with #?
# 4  
Old 11-28-2012
@pamu : That works...Great....Thank U. Smilie

@Jotne : I am able to rename the file starting with '#' as well as could create a file starting with '#'. I created the file using vi editor though, not by any source prog.
# 5  
Old 11-28-2012
I found a working solution, use \ in front of #

Code:
cat \#test
nano \#test
vi \#test

# 6  
Old 11-28-2012
@Jotne : yes, yes, thats also a solution I found out a few minutes ago Smilie..
actually '\' make cat escape '#' as a comment character....nice one
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Vim help.txt automatically open every time I open vi

Hi Friends, Every I try to open a vi window, vim help.txt automatically opens evertime. After doing ZZ or :q! also the same page opens automatically. How to stop this? Is it machine specific ? Other users who are opening the same servers and files are not facing this issue. Thanks... (3 Replies)
Discussion started by: sudiptabhaskar
3 Replies

2. UNIX for Beginners Questions & Answers

Vim help.txt automatically open every time I open vi

Hi Friends, Every I try to open a vi window vim help.txt automatically opens evertime. After doing ZZ or :q! also the same page opens automatically. How to stop this? Is it machine specific ? Other users who are opening the same servers and files are not facing this issue. Thanks... (1 Reply)
Discussion started by: sudiptabhaskar
1 Replies

3. UNIX for Advanced & Expert Users

cat can not open file

Hi All, I have stumbled upon very unique issue. In my script I am doing cat file and then greping and cutting so as to assign the value to variable. My file is, <mxc_tl_load_extractdata_prop.bsh> DB_USER=test_oper hostname=xxx FTP_USER=test1_operate MAIL_LIST=xxx@yyy.com... (1 Reply)
Discussion started by: paragd
1 Replies

4. UNIX for Dummies Questions & Answers

file hashing utility in unix

I am looking for a utility that does file hashing in unix. ...Please let me know of any good easy to use utility (3 Replies)
Discussion started by: jbjoat
3 Replies

5. UNIX for Dummies Questions & Answers

Help on cat filelist.txt |xargs -n1 find

I am trying to find all the files listed in a filelist.txt. Why cant I use something like this cat filelist.txt | xargs -n1 find $path (2 Replies)
Discussion started by: dragonpoint
2 Replies

6. Shell Programming and Scripting

cat vs head vs readline get variable from txt file

I have a file with a single filename in it, which I want to assign to a BASH variable, so I've been trying: c=$(head -1 somefile) echo $c which outputs correctly, but them when I do ... somecommand $c it says it can't find the file, is that because it's grabbing the whole line, and... (5 Replies)
Discussion started by: unclecameron
5 Replies

7. Shell Programming and Scripting

Unix / Linux Dialog Utility - how to open 2+ more dialog windows ?

Hi, example of Unix / Linux dialog utility is below. I am going to use dialog as simple GUI for testing of a modem. So I need to combine some dialog boxes into one. I need to have input box, output box, info box, dialog box, radiobox as in any standard program with graphical user... (2 Replies)
Discussion started by: jack2
2 Replies

8. UNIX for Dummies Questions & Answers

CAt utility in java

Hello friends, could you please advice me of how to traslate this program written in C to java? #include <cstdio> main( ){ char c; c = getchar( ); while (c != EOF) { putchar(c); c = getchar( ); } } I am supposed to test the difference in time between compiling the C... (2 Replies)
Discussion started by: bentaboha87
2 Replies

9. Shell Programming and Scripting

for i in `cat myname.txt` && for y in `cat yourname.txt`

cat myname.txt John Doe I John Doe II John Doe III ----------------------------------------------------------------------- for i in `cat myname.txt` do echo This is my name: $i >> thi.is.my.name.txt done ----------------------------------------------------------------------- cat... (1 Reply)
Discussion started by: danimad
1 Replies

10. UNIX for Dummies Questions & Answers

grep/cat/more -- search in a txt file and display content from a specific "keyword"

Hi, I have a .txt file Sample: ===================== NEXT HOST ===================== AEADBAS001 ip access-list extended BLA_Incoming_Filter ip access-list extended BLA_Outgoing_Filter access-list 1 permit xxxxxxxxxxxxxx access-list 2 permit xxxxxxxxxxxxxx =====================... (4 Replies)
Discussion started by: I-1
4 Replies
Login or Register to Ask a Question