Need help with programming issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help with programming issue
# 1  
Old 06-10-2013
Need help with programming issue

I need a UNIX shellscript command that will remove the 'Paragraph' mark from a simple text file. The Paragraph mark I'm referring to is the special character you can see in a WORD documant (similar to a backwards 'P') when you select the Show Paragraph Marks icon.

If someone can give me the decimal equivalent to the paragraph mark from the ASCII table, that might be enough to make the translation using the TR command.

Thanks.
# 2  
Old 06-10-2013
Quote:
Originally Posted by varefump
I need a UNIX shellscript command that will remove the 'Paragraph' mark from a simple text file. The Paragraph mark I'm referring to is the special character you can see in a WORD documant (similar to a backwards 'P') when you select the Show Paragraph Marks icon.

If someone can give me the decimal equivalent to the paragraph mark from the ASCII table, that might be enough to make the translation using the TR command.

Thanks.
Can you please provide sample input and desired output.
# 3  
Old 06-10-2013
Have used this little bit of code many times (OD command)

See the following:

Code:
$ echo hello stranger | od -An -t dC -w10
  104  101  108  108  111   32  115  116  114   97
  110  103  101  114   10

It provides the decimal ASCII translation for any text.
This should help you understand what the special characters are.
# 4  
Old 06-10-2013
It looks like my paragraph mark is a decimal 10.

Here is the code from the WORD document:

Code:
TRN*2*HRR843137
.9~

The segment should read:
Code:
TRN*2*HRR843137.9~

The special character that I want to delete is a line feed (Dec 10 Hex 0A).

I'm trying to remove all line feeds from a text file using this script:

Code:
cp $1 temp.txt
tr "\10" "\00" < temp.txt > temp.new
cp temp.new $1
rm temp.txt
rm temp.new

Can someone please provide a script that will do what I need?

Thanks.

Last edited by Don Cragun; 06-10-2013 at 02:37 PM.. Reason: Changed ICODE tags to CODE tags and removed unneeded FONT and SIZE tags
# 5  
Old 06-10-2013
A dec 10 byte is a simple newline. Nothing special. Are you certain that the special symbol is actually in the file and not an artifact of the program you're using to view the file?

If you want to remove those newlines: tr -d '\n'

To remove a byte using its value, you must use octal values; tr does not support base 10. Read its manual page. It isn't very complicated.

Regards,
Alister
# 6  
Old 06-10-2013
And, you're not removing the line feeds but trying replacing them with a null byte, which might lead to other artifacts.
# 7  
Old 06-10-2013
I got it to work.

Thanks to all the respondants.

It was actually a Carriage Return/Line Feed that I needed to delete from the file.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl programming issue

Dears, I want to print filename and count of each file in perl but failing to implement. `find $srcFolder -maxdepth 1 -type f -name "*$workDate*$fileExt" -exec sh -c ' && printf "$workDate|%s|%s\n" "$(wc -l<"$0")" *$workDate*$fileExt' {} \ >> /Sadique/filelog.out \\; 2> /dev/null`; ... (2 Replies)
Discussion started by: sadique.manzar
2 Replies

2. UNIX for Advanced & Expert Users

AIX runtime programming issue

I hope my title is accurate enough. I have a product that we port to various UNIX platforms. It is known to run on AIX but using the IBM compiler from years ago. Recently we got a different used AIX P5 platform running AIX 5.3 and we setup the GCC compiler (4.4.5 I think). C and C++ source code.... (5 Replies)
Discussion started by: Pug
5 Replies

3. Shell Programming and Scripting

Linux shell programming performance issue

Hi All, can any one help me on this please. Replace sting in FILE1.txt with FILE2.txt. FILE1.txt record must have at least one state is repeated once.But need to replace only from second occurrence in record in FILE1.txt Condition: order of searching the records in FILE2.txt is impartent.... (8 Replies)
Discussion started by: ureddy
8 Replies

4. UNIX for Dummies Questions & Answers

From iOS programming to Linux system programming

Hello. I like Linux and C programming language. Allways wanted to understand kernel and become a Linux system programmer. And I also like Objective-C and iOS. These two programming areas have relations: 1. Linux and iOS are UNIX-like systems, POSIX compliant. 2. It is useful to know C language... (2 Replies)
Discussion started by: Rockatansky
2 Replies

5. UNIX for Dummies Questions & Answers

How does unix system administration, unix programming, unix network programming differ?

How does unix system administration, unix programming, unix network programming differ? Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies

6. Programming

C Programming - Hardware Programming

Can someone help me on suggesting some ways to access the memory content in RAM directly from C/C++ source code. Please provide me any book name or any URL so that I can get an exhaustive knowledge over it. If possible please give me some tips on interacting with hardwares directly through... (3 Replies)
Discussion started by: nandumishra
3 Replies

7. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

8. Shell Programming and Scripting

Sed issue in K Shell programming

I am doing the following script in k shell sed -i 's/FILENAME/$i/g' TEST/test$j.ctl > TEST/control$j.ctl In the file it replaces $i for all FILENAME, it doesnot replace with the value of i. I put single quotes like below sed -i 's/FILENAME/'$i'/g' TEST/test$j.ctl > TEST/control$j.ctl I... (9 Replies)
Discussion started by: toshidas2000
9 Replies

9. Shell Programming and Scripting

Unix Systems Programming Vs Unix Programming

Several months ago I found a link that explained the difference between how a Unix Systems Admin would do scripting compared to what a Unix Programmer would do. It showed a basic script and then show several iterations that explained how the Systems Admin would change it to make it better. I was... (0 Replies)
Discussion started by: BCarlson
0 Replies

10. Programming

c programming or unix programming!?

i would like advice on the usbject of c programming (in the middle of reading a book on C). could i benefit more if i apply that knowledge in the unix format if i were able to, or would that take the point out of learning C, basically I want to stay away from strying too far away from unix and use... (1 Reply)
Discussion started by: moxxx68
1 Replies
Login or Register to Ask a Question