Sponsored Content
Top Forums Shell Programming and Scripting Replacing specific characters using sed Post 302749601 by vnayak on Friday 28th of December 2012 05:18:21 PM
Old 12-28-2012
Apple Replacing specific characters using sed

Yes. It is setup to be a delimiter. This file will be transferred to Excel at some stage and the caret is only sign that will allow other data in the file to be imported properly.

So for example each line in the file is constructed like this:

Code:
"OWNER^volume_name:\Volume_name^LONG^[Supervisor]^"
"OWNER^volume_name:\Volume_name\folder^LONG^[Supervisor]^"

I hope this make it a bit clearer.

vnayak

Quote:
Originally Posted by DGPickett
Is the caret mark a literal in your file. I think we need more examples.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replacing specific characters in a string

Hi Friends, Following is an output of a script OPWQERIUTYKLSADFJHGXZNMCVBWQOPERIUTYKLSADFJHGXZNMCVB I want to replace above string's 11 to 17 character by ******* (7 stars) How can it be done? Please somebody guide me. (6 Replies)
Discussion started by: anushree.a
6 Replies

2. Shell Programming and Scripting

help on sed replacing special characters

Hello, I have a file with many lines with below format: \abc\\1234 jkl\\567 def\\345 \pqr\\567 \xyz\\234 Here, i need to do 2 things. 1. replace \\ with \ 2. remove starting \ so output to be as below: (11 Replies)
Discussion started by: prvnrk
11 Replies

3. UNIX for Dummies Questions & Answers

sed replacing in vi, / characters in the middle

I tried to replace the following in vi: old: 'e/thesis/pp/zones/zones' new: 'd/so162/fix/pp' For that, I used: :%s/e/thesis/pp/zones/zones/d/so162/fix/pp/g but doesn't work, a trailing character error message appeared. How can I get it? Thanks in advance (3 Replies)
Discussion started by: Gery
3 Replies

4. Shell Programming and Scripting

Sed - merge lines bw 2 specific characters

Hi, I have a bash script and I am looking for a command that will merge specific lines together. Sample Data: registration time = 1300890272 Id = 1 setd = 0 tagunt = 26 tagId=6, length=8, value= tagId=9, length=5, value= tagId=7, length=2, value= tagId=16, length=2, value= tagId=32,... (8 Replies)
Discussion started by: Winsarc
8 Replies

5. Shell Programming and Scripting

SED Replacing all but one regex match on a line or specific matches

Hi, I'm attempting to rename some files that have spaces in them. Without linking sed commands together is it possible to replace the first three "." to " ". File.name.is.long.ext -> File name is long.ext I can get the desired effect with echo "File.name.is.long.ext" | sed 's/\./ /g;s/... (5 Replies)
Discussion started by: vectox
5 Replies

6. Shell Programming and Scripting

sed or tr to remove specific group of special characters

Hi, I have a input of the form: ..., word1, word2, word3... I want out put of the form word1, word2, word3 I tried echo '..., word1, word2, word3...' | tr -d '...,' but that takes out the commas in the middle too so I get word1 word2 word3 but I want the commas in the middle. ... (3 Replies)
Discussion started by: forumbaba
3 Replies

7. Shell Programming and Scripting

sed replacing specific characters and control characters by escaping

sed -e "s// /g" old.txt > new.txt While I do know some control characters need to be escaped, can normal characters also be escaped and still work the same way? Basically I do not know all control characters that have a special meaning, for example, ?, ., % have a meaning and have to be escaped... (11 Replies)
Discussion started by: ijustneeda
11 Replies

8. Shell Programming and Scripting

How delete characters of specific line with sed?

Hi, I have a text file with some lines like this: /MEDIA/DISK1/23568742.MOV /MEDIA/DISK1/87456321.AVI /MEDIA/DISK2/PART1/45753131.AVI /IMPORT/44452.WAV ... I want to remove the last 12 characters in each line that it ends "AVI". Should look like this: /MEDIA/DISK1/23568742.MOV... (12 Replies)
Discussion started by: inaki
12 Replies

9. Shell Programming and Scripting

Replacing specific entry using sed

Hi guys, I'm new to bash programming, so please pardon me. I'm trying to replace an entry's text in Books.txt This code works perfectly: sed -i "s/$BookTitle/$NewBookTitle/g" Books.txt But problem is, if there are double entries, it will also replace that entry. For example: ... (12 Replies)
Discussion started by: todaealas
12 Replies

10. Shell Programming and Scripting

sed command on AIX, replace specific characters

Hi, Im using sed on an AIX machine. I am trying to change the 137-139 characters if they are a ' 36'/'000' to a '036'. The positions that need to be changed are fixed. the source data that I have is$cat v.txt 4000422985400050462239065593606500000007422985707771046154054910075641MC0318AMWAY... (9 Replies)
Discussion started by: dsid
9 Replies
SG_READ_LONG(8) 						     SG3_UTILS							   SG_READ_LONG(8)

NAME
sg_read_long - send a SCSI READ LONG command SYNOPSIS
sg_read_long [--16] [--correct] [--help] [--lba=LBA] [--out=OF] [--pblock] [--verbose] [--version] [--xfer_len=BTL] DEVICE DESCRIPTION
Send SCSI READ LONG command to DEVICE. The read buffer is output in hex and ASCII to stdout or placed in a file. Note that the data returned includes the logical block data (typically 512 bytes for a disk) plus ECC information (whose format is proprietary) plus option- ally other proprietary data. OPTIONS
Arguments to long options are mandatory for short options as well. -S, --16 uses a SCSI READ LONG(16) command. The default action is to use a SCSI READ LONG(10) command. The READ LONG(10) command has a 32 bit field for the lba while READ LONG(16) has a 64 bit field. -c, --correct sets the 'CORRCT' bit in the SCSI READ LONG command. When set the data is corrected by the ECC before being transferred back to this utility. The default is to leave the 'CORRCT' bit clear in which case the data is not corrected. -h, --help output the usage message then exit. -l, --lba=LBA where LBA is the logical block address of the sector to read. Assumed to be in decimal unless prefixed with '0x' (or has a trailing 'h'). Defaults to lba 0. If the lba is larger than can fit in 32 bits then the --16 option should be used. -o, --out=OF instead of outputting ASCII hex to stdout, send it in binary to the file called OF. If '-' is given for OF then the (binary) output is sent to stdout. Note that all informative and error output is sent to stderr. -p, --pblock sets the 'PBLOCK' bit in the SCSI READ LONG command. When set the physical block (plus ECC data) containing the requested logical block address is read. The default is to leave the 'PBLOCK' bit clear in which case the logical block (plus any ECC data) is read. -v, --verbose increase the level of verbosity, (i.e. debug output). -V, --version print the version string and then exit. -x, --xfer_len=BTL where BTL is the byte transfer length (default to 520). If the given value (or the default) does not match the "long" block size of the device, the appropriate BTL is deduced from the error response and printed (to stderr). The idea is that the user will retry this utility with the correct transfer length. NOTES
If a defective block is found and its contents, if any, has been retrieved then "sg_reassign" could be used to map out the defective block. Associated with such an action the number of elements in the "grown" defect list could be monitored (with "sg_reassign --grown") as the disk could be nearing the end of its useful lifetime. The LBA and BTL (transfer length) arguments may be followed by the following multiplicative suffixes: c C *1; w W *2; b B *512; k K KiB *1,024; KB *1,000; m M MiB *1,048,576; MB *1,000,000; g G GiB *1,073,741,824; and GB *1,000,000,000 . Also a suffix of the form "x<n>" mul- tiplies the leading number by <n>. Alternatively numerical values can be given in hexadecimal preceded by either "0x" or "0X" (or with a trailing "h" or "H"). When hex num- bers are given, multipliers cannot be used. As a data point, Fujitsu uses a 54 byte ECC (per block) which is capable of correcting up to a single burst error or 216 bits "on the fly". [Information obtained from MAV20xxrc product manual.] EXIT STATUS
The exit status of sg_read_long is 0 when it is successful. Otherwise see the sg3_utils(8) man page. AUTHORS
Written by Douglas Gilbert. REPORTING BUGS
Report bugs to <dgilbert at interlog dot com>. COPYRIGHT
Copyright (C) 2004-2007 Douglas Gilbert This software is distributed under the GPL version 2. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- POSE. SEE ALSO
sg_reassign, sg_write_long, sg_dd sg3_utils-1.23 January 2007 SG_READ_LONG(8)
All times are GMT -4. The time now is 09:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy