Sponsored Content
Top Forums Shell Programming and Scripting Replacing all but last Hex characters in a text line Post 48994 by Ygor on Tuesday 23rd of March 2004 09:14:24 AM
Old 03-23-2004
You could use the tr command :-

tr '\012' '\174' < filein | tr '\015' '\012' | unix2dos > fileout

Explanation of above code:-
- use tr on the file to convert all 0A to 7C
- pipe result into tr to convert all 0D to 0A
- pipe result into unix2dos to expand all 0A to 0A0D

Notes:-
- Input lines can be of any length.
- Transfer files in binary mode to prevent automatic conversion.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing characters in file with line break

Hi, Apologies if this has been asked before, but I searched and was not able to find an answer. It's probably a simple question to answer for those of you with some experience, though... I have a relatively long string where tokens are separated by the colon (':') character. Let's say the... (10 Replies)
Discussion started by: johnemb
10 Replies

2. Shell Programming and Scripting

replacing certain characters with new line?

i have a text file which domains something like this 123213213213/32434342 324324324/12312321321 12321321,435435435 12321312 / 12313213 / 12435435345 4353213 , 123213213213 21321321312-12334324 234324324 - 235645645645 456456456 - 45456456456 - 45645645654243 how can i replace '/' and... (4 Replies)
Discussion started by: Bashar
4 Replies

3. Shell Programming and Scripting

Replacing hex characters '\x0D' with '\x0D\x0A'

Hello All, I have a requirement where I need to replaced the hex character - '\x0D' with 2 hex characters - 'x0D' & 'x0A' I am trying to use SED - But somehow its not working. Any pointers? Also the hex character '\x0D' can occur anywhere in the line. Can this also be accomplished... (6 Replies)
Discussion started by: paragkalra
6 Replies

4. Shell Programming and Scripting

Replacing text/characters in vi

ok, so i have the following text to replace but it's not working. can someone please help me out: :%s~awk '// {split($2,s,",");a=$1 FS s} /-/ {b=a} END{print b}'~tail -1~g I want to replace the entire awk command with tail -1. thanks (7 Replies)
Discussion started by: SkySmart
7 Replies

5. UNIX for Dummies Questions & Answers

Replacing hex characters

I have the following file consisting of dates and sample measurements: 05��Oct��2010 1.31�� 06��Oct��2010 1.32�� 07��Oct��2010 1.31�� The hex characters are \xc2\xa0 in sequence. I have tried to remove the characters as follows: sed -i '' -e 's/\xc2\xa0//g' file.dat and as follows... (6 Replies)
Discussion started by: figaro
6 Replies

6. Shell Programming and Scripting

Replacing text on every third line

I have file like this "copy table_name from filea.txt on node replace delimiter '|';" "copy table_name from fileb.txt on node replace delimiter '|';" "copy table_name from filec.txt on node replace delimiter'|';" "copy table_name from filee.txt on node replace delimiter '|';" "copy... (1 Reply)
Discussion started by: nnani
1 Replies

7. Shell Programming and Scripting

Replacing text in Perl given by command line

Hi I need to write a Perl script that the file given as first argument of the command line that will find all occurrences of the string given as the third argument of the command line and replace with the string given as the fourth argument. Name newfound file is specified as the second... (3 Replies)
Discussion started by: nekoj
3 Replies

8. Shell Programming and Scripting

Replacing end of line characters

Hello, I'm looking for some help in renaming data-timestamps stored within different calendar directories/files. The calendar directory has hundreds of ICS files: ~/Library/Calendars/F494C908.calendar/Events/92B65E439AAC.ics ~/Library/Calendars/F494C908.calendar/Events/DE7867E61969.ics... (8 Replies)
Discussion started by: Schubi
8 Replies

9. HP-UX

Replacing Hex Characters In A File Using awk?

Hi guys, First off, i'm a complete noob to UNIX and LINUX so apologies if I don't understand the basics! I have a file which contains a hex value of '0D' at the end of each line when I look at it in a hex viewer. I need to change it so it contains a hex value of '0D0A0A' I thought... (10 Replies)
Discussion started by: AndyBSG
10 Replies

10. Shell Programming and Scripting

Checking and replacing first line in text file, one-liner?

Hello, I'm looking to check only the first line of a file to see if it is a format string, like # -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -\*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2if the first line is anything else, insert the above string. I'd... (3 Replies)
Discussion started by: f77hack
3 Replies
ap-trapd(8)						      System Manager's Manual						       ap-trapd(8)

NAME
ap-trapd - a SNMP trap processing daemon SYNOPSIS
ap-trapd [ -i device ] [-u user ] [-s] DESCRIPTION
ap-trapd It's a SNMP trap processing daemon that accepts traps, parse them and store useful data using syslog, at logging LEVEL0. Specify device to listen for SNMP traps on the particular device (this option only works at Linux). To be running by user different from nobody you may specify user. To correct work with Smartbridges APs specify -s key (they use specific traps). Utility added to ap-utils from version 0.8. SYSLOG
To store traps to own log file you may add next string to your /etc/syslog.conf local0.* /var/log/ap-traps.log After doing it, just restart syslogd with command like killall -HUP syslogd TRAPS
When a trap is received, a message will be logged indicating that an action happened to the Access Point such as: Trap Reassociation: This trap message is sent when a Station reassociation request is received from Access Point. Trap Association: Indicates the reception of an association request packet and the sender Station's successful association with the Access Point. Trap Disassociation: This trap message is sent when a disassociation notification packet is received from a Station. Trap Reset: This trap message is sent when Access Point Resets. Trap Setting IP Address with Ping: This trap message is sent when the Access Point IP address is set with the transmission of a ping message. Trap Start Up: This trap message is sent when the Access Point Starts Up. Trap Failed To Erase Flash: This trap message is sent when Access Point Failed To Erase Flash. APClientScanning Access Point Client is scanning... APClientAuthenticating Access Point Client is authenticating with the AP. APClientAssociating Access Point Client is associating with the AP. APClientReAssociating Access Point Client is reassociating with the AP. APClientAuthenticationFailed Access Point Client has failed authenticating with the AP. APClientAssociationFailed Access Point Client has failed associating with the AP. APClientConnected Access Point Client has been connected with the AP. APClientDisconnected Access Point Client has been disconnected from the AP. APClientScanFailed Access Point Client has failed scanning! APClientJoinFailed Access Point Client has failed joining! APClientJoining Access Point Client is in join state. Smartbridges specific TRAPS MultiAttachedStation Multiple attached stations in the ethernet size SECURITY Utility ap-trapd must be running by 'root', after opening port utility change owner to 'nobody', so this user must exist in you sys- tem. You may set user using -u option as described below for change default unprivileged user. AUTHOR
Roman Festchook <roma@polesye.net> http://ap-utils.polesye.net SEE ALSO
ap-config(8), ap-mrtg(8), syslogd(8) Wireless Access Point Utilities for Unix ap-trapd(8)
All times are GMT -4. The time now is 06:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy