How to remove ^Z (eof) using sub in awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to remove ^Z (eof) using sub in awk
# 1  
Old 05-13-2005
Question How to remove ^Z (eof) using sub in awk

I am looking for the substitution expression to remove the eof ^Z character at the end of a file in UNIX.

Can anyone help?

Thank you !
# 2  
Old 05-13-2005
check this thread out:

https://www.unix.com/showthread.php?t...light=dos+unix

same issue, just substitute ^M with ^Z
# 3  
Old 05-13-2005
Since you are working with DOS text files, unix has a utility called either dos2ux or dos2unix which cleans up all the non-unix crud in DOS files moved to unix.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Remove character \r and \n in awk

Hi Everybody: I need your help, please... I have this file *.txt 0000 | 16010201 22000000 67892000 00000000 00000000 00000100 72246681 28E08236 | ~~~~"~~~g~ ~~~~~~~~~~~~~r$f~(~~6 | 0020 | 10476173 90010100 10000000 00000001 05000226 17163011 12442212 48140484 |... (2 Replies)
Discussion started by: solaris21
2 Replies

2. Shell Programming and Scripting

How can I remove first column with awk?

cat input.txt a x b y c z Expected output x y z (11 Replies)
Discussion started by: cola
11 Replies

3. Shell Programming and Scripting

awk remove first duplicates

Hi All, I have searched many threads for possible close solution. But I was unable to get simlar scenario. I would like to print all duplicate based on 3rd column except the first occurance. Also would like to print if it is single entry(non-duplicate). i/P file 12 NIL ABD LON 11 NIL ABC... (6 Replies)
Discussion started by: sybadm
6 Replies

4. Shell Programming and Scripting

Awk: Remove Duplicates

I have the following code for removing duplicate records based on fields in inputfile file & moves the duplicate records in duplicates file(1st Awk) & in 2nd awk i fetch the non duplicate entries in inputfile to tmp file and use move to update the original file. Requirement: Can both the awk... (4 Replies)
Discussion started by: siramitsharma
4 Replies

5. Shell Programming and Scripting

In awk: unexpected EOF while looking for matching `"'

I am trying to get grep with awk command into variable. But facing error. Could someone pls help. $ cat test_file DEPLOYMENT="abc" # com cluster="bcn" $ grep DEPLOYMENT test_file | awk -F "\"" '{ print $2 }' abc $ a=`echo "grep DEPLOYMENT test_file | awk -F \"\\\"\" '{ print $2 }'"` ;... (6 Replies)
Discussion started by: Manasa Pradeep
6 Replies

6. Shell Programming and Scripting

awk to remove last two -*-*

fq-bar-something-1.0-r1.src.rpm ----> fq-bar-something fq-bar-xx-r1-rel.src.rpm ---------> fq-bar-xx fq-bar-ff-ver-11-rel.src.rpm -------> fq-bar-ff-ver any help? (5 Replies)
Discussion started by: yanglei_fage
5 Replies

7. Shell Programming and Scripting

remove last characters after %EOF (pdf binary file)

Hi, I want to know how I can remove the last characters of ANY pdf file. I read it under "od" in the command shell to see which were the last characters: $od corruptedfile.pdf -c When I see the file, I need to keep only the last characters, or "end of the file": %EOF (obviously keeping all... (1 Reply)
Discussion started by: diegugawa
1 Replies

8. Shell Programming and Scripting

AWK remove string in between ()

Hi Everyone, 1.txt test here (888_f)a/fff (eeee) test2 (q)--(qq) the output is test here a/fff test2 -- means remove the characters in between (), and () itself. Please advice. Thanks (3 Replies)
Discussion started by: jimmy_y
3 Replies

9. Shell Programming and Scripting

confused with << EOF EOF

Hi friends , I am confused with << EOF EOF Most of the cases I found sqlplus $db_conn_str << EOF some sql staments EOF another exapmle is #!/bin/sh echo -n 'what is the value? ' read value sed 's/XXX/'$value'/' <<EOF The value is XXX EOF (1 Reply)
Discussion started by: imipsita.rath
1 Replies

10. UNIX for Dummies Questions & Answers

Appending to EOF using AWK

In a previous post I needed to walk through a list of files. This works fine, but when I attempt to use the nawk line (below) I can only write to first file that's found. The files I'm trying to write to (${target_dir}${product}.html) already exist and are created by another part of my script that... (1 Reply)
Discussion started by: ricksj
1 Replies
Login or Register to Ask a Question