Sponsored Content
Top Forums Shell Programming and Scripting Convert special charachter ^C to new line Post 302387429 by vnag97 on Friday 15th of January 2010 05:51:29 PM
Old 01-15-2010
Convert special charachter ^C to new line

Hi,

I have a file, which contains ^C or ^A characters from mainfrme system, it's dec 192 or octal 300 hex C0. I want to replace this character with new line.

I used commands, but it didn't worked.
Code:
 
tr '\o300' '\n' <t >t2
#or 
tr '\xC0' '\n' <t  > t2

Can somebody help me to do it?
[code]
-----------------------------------------------------------------------
VV100109000004000 CSS1001080001735 01/09/2010^A{1:F01
S33AXXX1653006546}{2:O9500007100109IRVTUS3NCXXX34498288201001090007N}{3:{10
8:CSS1001080001735}}{4:
:20:CSS1001080001735
:25:8900600268 :28C:5/1
:60F:C100108USD0,
:61:100108CD1039000000,NTRF021000018//DSP1001080119200
B/O,319916
:61:100108CD730407833,34NTRF5803563//FDF1001080038900
B/O:
:61:100108DD1039000000,S900100108026962//F2S1001087876400
O/B:ABIC/S33
:61:100108DD730407833,34NTRFDSP1001080018200//DSP1001080018200
BEN,CUS466087 OIS
:62F:C100108USD0,
:64:C100108USD0,
-}{5:{CHK:CE54EED6A6B2}}[B][COLOR=darkred]^C
ZZ100109000005000 ZZ100109000005001 01/09/2010 00:09:01:23^A{1:F01
30001109XXXX0000000010}{2:I21030003012XXXXN}{4:
:20:FX1742602
:30:100113
:21:1742602

Last edited by vnag97; 01-19-2010 at 11:49 AM.. Reason: use code tags please, ty
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Counting occurences of specific charachter in a file

Hi, I need to count the number of occurences of the character " in a file that contains huge number of records. What command could I use? Please specify in detail since I am new :| Thanks much. (3 Replies)
Discussion started by: GMMike
3 Replies

2. Shell Programming and Scripting

convert special character like £

i had a shell script writing a xml file. I need to use "& # 163;" instead of "£", and replace others characters like: > to &gt; , and so on.. Anyone know how to convert the character automatically? my script as below: do # GET FEED REC SQL2="SELECT A.*, B.subject FROM feed_details A,... (1 Reply)
Discussion started by: cynnie
1 Replies

3. Shell Programming and Scripting

How to filer a line in special condition?

Hi, I hava log file which has the following output : Created RELEASE in dist/filename_release_1_0_20090210.zip Created RELEASE in dist/filename_release_1_1_20090210.zip Created RELEASE in dist/filename_release_1_3_20090210.zip Created RELEASE in... (6 Replies)
Discussion started by: bhaskar_m
6 Replies

4. Shell Programming and Scripting

How to remove special characters from each line?

Hello, Is there a simpler way to remove special characters (color codes) from each lines in a log file? I use sed like in the example below but I think there should be a more simple way to achieve the same result: $ cat -vet file1 ^, , , , Maybe to convert the file somehow? ... (5 Replies)
Discussion started by: majormark
5 Replies

5. Shell Programming and Scripting

delete line upto the nth occurence of a particular charachter.

hi all i want to delete a line upto a particular character. here is example. cp cms/images/wifi-zone.png i want to delete the line till . (cp cms/images/wifi-zone.) so the output wud be "png" only how can i do it? also please note down that dot (.) can also occur multiple... (12 Replies)
Discussion started by: kashifv
12 Replies

6. Shell Programming and Scripting

Newline charachter in Ksh-Linux

Hello, I'm trying to create a muliti value shell variable with newlines inside it, So that I can read the values of that variable individually line by line, but KSH seems to be stripping my variable of newlines in LINUX, but UNIX its working fine. Here's Example : String =... (3 Replies)
Discussion started by: Sanju1236
3 Replies

7. Shell Programming and Scripting

convert single line output to multiple line

Hi all, I have a single line output like below echo $ips 10.26.208.28 10.26.208.26 10.26.208.27 want to convert above single line output as below format. Pls advice how to do ? 10.26.208.28 10.26.208.26 10.26.208.27 Regards Kannan (6 Replies)
Discussion started by: kamauv234
6 Replies

8. Shell Programming and Scripting

How to convert special characters?

Hi All, I have some text including Turkish characters and the 3rd party application that reads my file does not supporting this character set (at least, I have no control on it). So, I used below conversion for maximum character support but still have problems with "İ" and "Ş". Application... (5 Replies)
Discussion started by: mrcrowley
5 Replies

9. Shell Programming and Scripting

Repeat line convert upper line

HI Guys, My Input :- R3 AV44 50 0 100 100 100 R3 AV44 1 0 100 100 100 R3 AV45 50 0 100 100 100 R3 AV45 0 3 100 100 100 R3 AV45S 50 0 100 100 100 R3 AV45S 0 4 100 100 100 Output :- R3 AV44 50 0 100 100 100 1 0 100 100 100 R3 AV45 50 0 100 100 100 0 3 100 100 100 R3 AV45S 50 0... (9 Replies)
Discussion started by: pareshkp
9 Replies

10. UNIX for Dummies Questions & Answers

Grep with special chars line by line

I have a file that includes strings with special characters, eg file1 line: 1 - special 1 line: = 4 line; -3 etc How can I grep the lines of file1 from file2, line by line? I used fgrep and egrep to grep a particular line and worked fine, but when I used: cat file1|while read line;do... (2 Replies)
Discussion started by: FelipeAd
2 Replies
magic(4)						     Kernel Interfaces Manual							  magic(4)

NAME
magic - Magic file for the file command SYNOPSIS
/etc/magic DESCRIPTION
The magic file is used by the file command to identify files that have some sort of magic number. A magic number is any numeric or string constant that identifies the file containing the constant. The format for the magic file is as follows: offset type operator,value string The fields should be separated by tabs. Each record must be contained on one line. The fields contain the following data: This field contains the number of bytes from the beginning of the file on which you are running the file command to the first byte of the magic number of character string you want to identify. Use a right angle bracket (>) to indicate a continuation line that supplies additional information describing the file. This field contains information about the data type of the magic number or character string at the specified byte offset. Valid data types for this field are: Unsigned character type Unsigned short type Long type Character (byte) string This field contains instructions for the file command on how to compare the value read from the file being checked with the value stored in the Value Type field of the magic file. The valid comparison operators are: The two values are equal. The value in the file being checked is greater than the value in the magic file. The value in the file being checked is less than the value in the magic file. All the bits in the magic file value must be set in the value from the file being checked. Note that the Comparison Operator field is optional. If you do not specify the operator, the values are expected to be equal. This field contains the value used to compare what is read from the file being checked by the file command. You can use decimal, hex, or octal numbers in this field or character strings in the form of regular expressions. Precede all hex numbers with the characters zero and x (for example, 0x80). To specify an octal number, precede it with a zero (for example, 0200). Decimal numbers require no special representation and should be written as integers (for example, 128). The rules for specifying character strings follow those of the ed editor (see ed(1)) for regular expressions, with two extensions: You use the backslash () to escape an unprintable character. The string can contain all special character such as , , , and f. If a backslash appears in the string, it must be escaped with a second backslash (\). You can use octal representation to specify any byte value other than zero (0). Text found in the file can be inserted into the printed string if it is preceded and followed by \% delimiters. All text found between these delimiters is displayed as the print string. This regular expression search never terminates until a match is explicitly found or rejected. The special character is a valid character in the patterns. Therefore, the pattern .* should never be used here. This field contains the string to print. The string provides information about the file. The string can include text found in the file when requested with an appropriate printf() format. EXAMPLES
The following is an example of a script: string ^#!{ }*\%[^ ]*\% %s The following are examples of executable images: >2 short 02 POSIX >2 short 01 SVID >16 long >0 not stripped The following are examples of text and data files: 0 string ^1h[0-9][0-9][0-9][0-9][0-9] sccsfile 0 string ^#ifndef c program 0 string ^070707 ASCII cpio archive FILES
/etc/magic RELATED INFORMATION
Commands: file(1) delim off magic(4)
All times are GMT -4. The time now is 02:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy