HOW: Dealing with new line character Wiindows-vs-UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HOW: Dealing with new line character Wiindows-vs-UNIX
# 8  
Old 05-04-2011
I have no idea what that box type character is, it doesn't look like a newline character though.

You can use dump or xxd and find the hex representation of that character:
Code:
head -1 your_file | your_file

Let's say the character is 0x09, you can use the following script to replace that character with dos newline:
Code:
sed 's/\009/\r\n/g' infile > outfile

Hope this helps.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies

2. Shell Programming and Scripting

Read character by character in line in which space is also included

Hi friend, I have one file , and i want to read that file character by character. I need this script in ksh. while using read option with -n1 am getting error. while read -n1 c read has bad option And if i am using below script, then if in a line has space like this ( Pallvi mahajan)... (10 Replies)
Discussion started by: pallvi_mahajan
10 Replies

3. Shell Programming and Scripting

Sed: delete on each line before a character and after a character

Hi there, A total sed noob here. Is there a way using sed to delete everything before a character AND after another character on each line in a file? The deletion should also delete the indicating characters(here: an opening and a closing parenthesis). The original file would look like... (3 Replies)
Discussion started by: bnbsd
3 Replies

4. Shell Programming and Scripting

Unix command to select first few characters and last character of a line

I have a huge file and I want to select first 10 charcters and last 2 characters of everyline and than will filter the unique line. I know, it must be easy bt I am new to unix scripting:) Ex. I have file as below and need to e3kbaird and last 2 characters. and than unique records. ... (3 Replies)
Discussion started by: Sanjeev Yadav
3 Replies

5. Shell Programming and Scripting

Unix-problem of New line character

Hi All, "Please read the below information carefully." i have tried the below code for counting the number of lines present in text file ignoring blank lines #! /bin/bash clear rdCount=0; while read myline do if ; then echo "line is empty" else echo $myline let... (10 Replies)
Discussion started by: aish11
10 Replies

6. UNIX for Dummies Questions & Answers

Need help removing last character of every line if certain character

I need help removing the last character of every line if it is a certain character. For example I need to get rid of a % character if it is in the last position. Input: aaa% %bbb ccc d%dd% Output should be: aaa %bbb ccc d%dd I tried this but it gets rid of all of the % characters.... (5 Replies)
Discussion started by: raptor25
5 Replies

7. Solaris

Line too long error Replace string with new line line character

I get a file which has all its content in a single row. The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file. I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies

8. HP-UX

How to remove new line character and append new line character in a file?

Hi Experts, I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line. File is comma (,) seperated. Eg: ID,Client ,SNo,Rank 37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies

9. Shell Programming and Scripting

Awk not working due to missing new line character at last line of file

Hi, My awk program is failing. I figured out using command od -c filename that the last line of the file doesnt end with a new line character. Mine is an automated process because of this data is missing. How do i handle this? I want to append new line character at the end of last... (2 Replies)
Discussion started by: pinnacle
2 Replies
Login or Register to Ask a Question
btowc(3C)																 btowc(3C)

NAME
btowc(), wctob() - conversion between single-byte and wide character SYNOPSIS
DESCRIPTION
The function determines whether c constitutes a valid (one-byte) character in the initial shift state. The function determines whether c corresponds to a member of the extended character set whose character representation is a sin- gle byte when in the initial shift state. APPLICATION USAGE
The prototypes of these functions are available to applications if they are: a. conformant. b. Compiled with the macro with a value >=500. c. Compiled with the macro with a value >= 200112. EXTERNAL INFLUENCES
Environment Variables The behavior of these functions is affected by the category. RETURN VALUE
The function returns if c has the value or if c as an unsigned character does not constitute a valid (one-byte) character in the initial shift state. Otherwise, it returns the wide character representation of that character. The function returns if c does not correspond to a character with length one in the initial shift state. Otherwise, it returns the single- byte representation of that character. ERRORS
No errors are defined. AUTHOR
was developed by HP and Mitsubishi Electric Corp. SEE ALSO
thread_safety(5). btowc(3C)