sed Or Grep Problem OR Terminal Problem?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers sed Or Grep Problem OR Terminal Problem?
# 8  
Old 02-12-2015
What is your OS ?
Are you sure that your input file has several lines, you can check with wc -l file ?
# 9  
Old 02-12-2015
Yes, the input does contain lines and txt. It has 2097152 lines to be exact, filled with a mixture of lines like these

This is the exact glimpse of what it's actually inside.
Code:
A08
AAG
ABF
ACE
ADD
AEC
AFB
AGA
A80
A89
A98
B0G

So I do wish to remove those line containing 0 8 & 9 Smilie
# 10  
Old 02-12-2015
Show us the output from the command line:
Code:
ls -l *put.txt; echo 'output:'; cat output.txt


Last edited by Don Cragun; 02-12-2015 at 05:29 AM.. Reason: Remove cat of input.txt now that sample has been posted.
# 11  
Old 02-12-2015
I got this as an outcome :

Code:
ls -l *put.txt; echo 'input:'; cat input.txt; echo; echo 'output:'; cat output.txt
-rw-r--r--@ 1 Nexeu  staff  17639800 Feb 11 23:53 input.txt
input:
9DCGA8D
A88GDCF8
output:
cat: output.txt: No such file or directory

What was it suppose to do btw? Smilie
# 12  
Old 02-12-2015
Quote:
Originally Posted by disedorgue
Hi,
If you have names of file with quote, you can to have this problem, example:
Code:
$ touch "XX'YY"
$ ls -l
total 0
-rw-r--r-- 1 XXXXXXXX Domain Users 0 12 févr. 10:06 XX'YY
$ for i in *; do echo $i :done
> ^C
$ for i in *; do echo "$i" :done
>

Regards.
Might be due to the colon in front of the done. I could replicate that behaviour but it was gone when using a semicolon.

---------- Post updated at 10:42 ---------- Previous update was at 10:41 ----------

Quote:
Originally Posted by Nexeu
I got this as an outcome :

Code:
ls -l *put.txt; echo 'input:'; cat input.txt; echo; echo 'output:'; cat output.txt
-rw-r--r--@ 1 Nexeu  staff  17639800 Feb 11 23:53 input.txt
input:
9DCGA8D
A88GDCF8
output:
cat: output.txt: No such file or directory

What was it suppose to do btw? Smilie
When applying any of the proposals to this input, the output must be empty.
This User Gave Thanks to RudiC For This Post:
# 13  
Old 02-12-2015
Quote:
Originally Posted by Nexeu
I got this as an outcome :

Code:
ls -l *put.txt; echo 'input:'; cat input.txt; echo; echo 'output:'; cat output.txt
-rw-r--r--@ 1 Nexeu  staff  17639800 Feb 11 23:53 input.txt
input:
9DCGA8D
A88GDCF8
output:
cat: output.txt: No such file or directory

What was it suppose to do btw? Smilie
This shows us that you did not run the sed command you showed us because the file output.txt does not exist. Furthermore, despite what you said was in input.txt in post #9, we now know that there are only two lines in input.txt and both of them contain decimal digits ("8" and "9" in the 1st line and "8" three times in the 2nd line). What the other 17,397,783 bytes are in that file is a mystery, but are apparently non-printable characters (quite possibly control characters such as null bytes). So, we would expect that if you had run the sed command:
Code:
sed '/[[:digit:]]/d' input.txt > output.txt

the file output.txt would exist but would be empty. But, since sed is only defined to work on text files and it doesn't appear that input.txt is a text file; all bets are off.
# 14  
Old 02-12-2015
Sorry, yes I kind deleted the output.txt.
This is the out come after apply this sed commad to input.txt.

sed '/[[:digit:]]/d' input.txt > output.txt

The result of output.txt is still nothing inside.


Code:
Untitleds-MacBook-Pro:Documents Nexeu$ ls -l *put.txt; echo 'input:'; cat input.txt; echo; echo 'output:'; cat output.txt
-rw-r--r--@ 1 Nexeu  staff  17639800 Feb 11 23:53 input.txt
-rw-r--r--  1 Nexeu  staff         0 Feb 12 17:00 output.txt
input:
9DCGA8D
A88GDCF8
output:
Untitleds-MacBook-Pro:Documents Nexeu$

The output.txt is blank as usual and nothing is inside.

If the characters are non-printable, what are the options I have to fix this? In the input.txt, there's only A-Z and 0 8 9 characters, no any other special characters. Smilie

I'm using Mac Os X Yosemite Ver 10.10.2 (14C109) btw
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Silly problem with sed and grep

I am trying to delete all empty lines from a file using either grep -v ^$ file or sed '/^$/d' file But neither one is working. I have uploaded the file I am trying to modify. Any help will be greatly apreciated. (3 Replies)
Discussion started by: Xterra
3 Replies

2. HP-UX

Problem with terminal

Hi Guys, I'm using my putty to connect to the HP-UX test box. Once I get connected to server there seem to be something wrong with my putty that behaves very odd. for example it starts from the half of the screen. I really dont know how to explain this problem. or for instance when i run vi to... (2 Replies)
Discussion started by: messi777
2 Replies

3. Linux

Terminal logging character problem -Newbie-

Im a complete newbie tryin to work with linux centos; in terminal wanted to log with script command; but output file has some strange characters when I try to open with gedit or bluefish terminal , gedit, bluefish encoding is utf-8 ; Script started on Mon 08 Mar 2010 03:32:39 PM EET... (2 Replies)
Discussion started by: anacondauser
2 Replies

4. Shell Programming and Scripting

Problem - gnome terminal shell scripting

I've a python script named rwe.py. I'm running the program in three separate terminals. If one of the executing program stops . I want to leave the terminal as it is so that i can see the error. i wrote a the below script and used cron to run it every one hour to check if the three programs are... (0 Replies)
Discussion started by: msteve2002
0 Replies

5. Shell Programming and Scripting

Problem with gnome-terminal

Hello everyone. This is my first post.:o Using Ubuntu 8.04 and bash 3.2.39 i'm trying to adapt my routine to this platform. So, this means forget xterm and use gnome-terminal (as default ubuntu terminal). EveryDay i need to connect to several servers, and i've made a Tcl'script to make this... (1 Reply)
Discussion started by: trutoman
1 Replies

6. Linux

tty terminal permissions problem

I'm hoping someone can help me out here. I'm having a problem on my Red Hat Enterprise 5 Server where my tty devices "tty" are being set to read only permissions. I need them to be set to 777 in order to write to the serial printers through a custome application. I have gone through many... (2 Replies)
Discussion started by: Netwrkengeer
2 Replies

7. Programming

terminal problem

i am executiing some commands using system an popen command in c. while executing the code . some data is shown on terimal without using any print statement. how can i solve this problem thank u sree (1 Reply)
Discussion started by: phani_sree
1 Replies

8. SCO

Terminal Allocation Problem

Hello All, I am facing a problem on SCO Open Server V 5x, We are using serial communication on dumb terminals, right now i am facing a problem on some terminals, as they are not showing thier previous tty no, as tty13 or tty18, but they are showing ttya6 or ttya4, i also tried to move and link... (5 Replies)
Discussion started by: Awadhesh
5 Replies

9. UNIX for Advanced & Expert Users

terminal type problem with cygwin on aix

hey, I use cygwin to connect to AIX 5.2 but when I open vi I get an error saying: ex: 0602-108 cygwin is not a recognized terminal type how can I fix that? I thought cygwin was tty vt100? (1 Reply)
Discussion started by: rein
1 Replies

10. UNIX for Dummies Questions & Answers

terminal problem

Hi all While trying to upon a new window it is saying UNABLE TO GET PTY..what does this means how to solve it Thanks Prafulla (4 Replies)
Discussion started by: Prafulla
4 Replies
Login or Register to Ask a Question