Control Characters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Control Characters
# 1  
Old 11-18-2014
Control Characters

Hallo Team,

I am trying to get rid of the dollar sign. I managed to remove all the other special characters but i am struggling with this one.

Code:
-bash-3.2$ cat -e missing_revenue_20141112.csv|less|head
BW0522168531211141180935668@196.23.110.141$
BW092218784121114-370120610@196.23.110.141$
BW1404407551211141874517771@196.23.110.141$
BW001058223121114-2086341879@196.35.130.5$
BW001126190121114-710205576@196.35.130.5$
BW002549135121114563646299@196.35.130.5$
BW0053227321211141454430109@196.35.130.5$
BW020430589121114-1737491030@196.35.130.5$
BW0206420091211141773544379@196.35.130.5$
BW0439517101211141952205283@196.35.130.5$

They are invisible

Code:
-bash-3.2$ cat missing_revenue_20141112.csv|head
BW0522168531211141180935668@196.23.110.141
BW092218784121114-370120610@196.23.110.141
BW1404407551211141874517771@196.23.110.141
BW001058223121114-2086341879@196.35.130.5
BW001126190121114-710205576@196.35.130.5
BW002549135121114563646299@196.35.130.5
BW0053227321211141454430109@196.35.130.5
BW020430589121114-1737491030@196.35.130.5
BW0206420091211141773544379@196.35.130.5
BW0439517101211141952205283@196.35.130.5
-bash-3.2$

Please assist.
# 2  
Old 11-18-2014
Code:
man cat

tells me that -e adds a $ at the line end (so you could see trailing space characters).
While -v shows the special characters and no $ line ends.
# 3  
Old 11-18-2014
I suppose you could try:

Code:
 
cat missing_revenue_20141112.csv | tr -d '\n'

however, I doubt that'll have the effect your expecting Smilie

hint: read the man page MadeInGermany provided Smilie
# 4  
Old 11-20-2014
Is this the same as this post?
# 5  
Old 11-20-2014
Basic longhand example, OSX 10.7.5, default bash terminal.
This has its limitations but is simple and a starting point.
Code:
Last login: Thu Nov 20 18:22:55 on ttys000
AMIGA:barrywalker~> line="lkasdlkjalskdj@lkdfklksdflksj123$"
AMIGA:barrywalker~> line="${line:0:$((${#line}-1))}"
AMIGA:barrywalker~> echo "$line"
lkasdlkjalskdj@lkdfklksdflksj123
AMIGA:barrywalker~> _

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Control characters in UNIX

Hi, My files are showing some control characters in vi editor ^M ^@ and somtimes ^H I removed ^M with %s/^M//g command but how to represent ^@ and ^H e.g. for ^M it is hold ctrl then v and m.. Please help.. I am very new to unix.. (7 Replies)
Discussion started by: prabhat.diwaker
7 Replies

2. Shell Programming and Scripting

Control characters -weird problem

I am using Korn shell on Linux 2.6x platform , and I am suing the following code to capture the lines which contain CONTROL CHARACTERS in my file : awk '/]/ {print NR}' EROLLMENT_INPUT.txt The problem is that this code shows the file has control characters when the file is in folder A ,... (2 Replies)
Discussion started by: kumarjt
2 Replies

3. Shell Programming and Scripting

sed replacing specific characters and control characters by escaping

sed -e "s// /g" old.txt > new.txt While I do know some control characters need to be escaped, can normal characters also be escaped and still work the same way? Basically I do not know all control characters that have a special meaning, for example, ?, ., % have a meaning and have to be escaped... (11 Replies)
Discussion started by: ijustneeda
11 Replies

4. Shell Programming and Scripting

Control Characters

Can somebody please help me with the query. ? I want a part of program of which should look for control characters in the flat file , when it finds it, displaying message that Control Characters found..! Please help me (13 Replies)
Discussion started by: iamnoone
13 Replies

5. Shell Programming and Scripting

Urgent : Control Characters

Can somebody please help me with the query. ? I want a part of program of which should look for control characters in the flat file , when it finds it, displaying message that Control Characters found..! Please help me (1 Reply)
Discussion started by: iamnoone
1 Replies

6. Shell Programming and Scripting

screen control characters

Hi, Can anyone help me with controlling the cursor position from a shell script. Things like moving left,right,up,down etc Anyone have any ideas? (2 Replies)
Discussion started by: ajcannon
2 Replies

7. Shell Programming and Scripting

how to replace control characters using sed?

How can I use sed to replace a ctrl character such as 'new line' (\0a) to something else? Or any other good command can do this job? Thanks, Hillxy (5 Replies)
Discussion started by: hillxy
5 Replies

8. UNIX for Dummies Questions & Answers

Remove control characters

Hi, When I do a man and save it into a file, I end up getting a lot of control characters. How can I remove them?? I tried this: /1,$ s/^H//g But I get an error saying "no previous regular expression". Can someone help me with this. Thanks, Aravind (5 Replies)
Discussion started by: aravind_mg
5 Replies

9. UNIX for Dummies Questions & Answers

getting rid of control characters

how can i get rid of the control characters , ex. ^M, ^G, in a file? thanks... (2 Replies)
Discussion started by: apalex
2 Replies

10. UNIX for Dummies Questions & Answers

printing control characters

using c-shell, does anyone know how to send control characters to the printer before the job? I need to set a printer to print in condensed mode HELP (1 Reply)
Discussion started by: mglinsk
1 Replies
Login or Register to Ask a Question