Sponsored Content
Top Forums Shell Programming and Scripting Find and Replace Path in UNIX Post 302751495 by nsyed.dw on Friday 4th of January 2013 04:30:29 AM
Old 01-04-2013
Syntax:

sed 's_/search/path_old_/replace/path_new/_' ttt.txt > tmp.txt

Error:

sed: command garbled: s_/search/path_old_/replace/path_new/_

Above systax is not working for me, please help me.

---------- Post updated at 04:30 AM ---------- Previous update was at 04:25 AM ----------

Please any once can help me....
 

10 More Discussions You Might Find Interesting

1. HP-UX

URGENT: UNIX FTP cannot find path error

Dear all We are currently working on to install some ERP system in wjhich we need to FTP from unix to windows 2000 machine We run ./lodrun to get files from d/xxxxx/xxxx directory but the ftpoutput.log file shows following error FTP: xxxxxxxxx system cannot find the path specified... (1 Reply)
Discussion started by: minix
1 Replies

2. UNIX for Advanced & Expert Users

how to find complete path of a file in unix

hi experts(novice people can stay away as it is no child's game), i am developing a script which works like recycle bin of windows. the problem i am facing is that when ever i am trying to delete a file which is situated in parent directory or parent's parent directory i am unable to capture... (1 Reply)
Discussion started by: yahoo!
1 Replies

3. UNIX for Dummies Questions & Answers

how to find complete path of a file in unix

hi experts(novice people can stay away as it is no child's game), i am developing a script which works like recycle bin of windows. the problem i am facing is that when ever i am trying to delete a file which is situated in parent directory or parent's parent directory i am unable to capture... (5 Replies)
Discussion started by: yahoo!
5 Replies

4. UNIX for Dummies Questions & Answers

how to find a path within unix root directory

I need to know whether nyfile/mypath exists on the file system in the root directory. How to do this (1 Reply)
Discussion started by: ramky79
1 Replies

5. UNIX for Dummies Questions & Answers

Find unix path to a file?

I know this is very newbie ... but I need help determining the proper file path to file...Have no idea how to do this I'm on a Mac OS X 10.6 Snow Leopard thanks very much (4 Replies)
Discussion started by: jmarc
4 Replies

6. Shell Programming and Scripting

Find and replace string from file which contains variable and path - SH

e.g. /home/$USER/.config replace it with "" (empty) Is this possible? I think you should play a bit with sharps ## and sed:b: (2 Replies)
Discussion started by: hakermania
2 Replies

7. Emergency UNIX and Linux Support

Find, replace, file path in multiple files for Solaris 10

Guys I have a big issue that I need to get fixed ASAP however I can not seem to find a way to do it. We started to use zones with Solaris 10 at work and we moved a zone from a SIT box to a DEV box. Problem is the software we have installed is looking at a /lcl/sit/apps/ path and it needs to look... (5 Replies)
Discussion started by: LRoberts
5 Replies

8. Shell Programming and Scripting

find and replace a path with sed?

Hi, I am attempting to find the path /subject/grin* and replace it with /subject/$i My attempt: for i in $(ls) do sed -e 's:"/subjects/grin.*":"/subjects/$i.*":g' and several variants with no luck. Please help. Thanks! (8 Replies)
Discussion started by: JC_1
8 Replies

9. Shell Programming and Scripting

Pattern match a path anywhere in the line and replace it with new path

I want to pattern match only path part from below and replace them with new path string. LoadModule jk_module /fldrA/fldrBaf/fldrCaa/modules/mod_jk.so JkWorkersFile /fldrA/fldrBaf/fldrCaa/config/OHS/ohs1/workers.properties JkLogFile... (4 Replies)
Discussion started by: kchinnam
4 Replies

10. Shell Programming and Scripting

Find and replace the path value in files, pattern is not full known.

Hi, I need to do find and replace, but the pattern is not full known. for example, my file has /proj/app-d1/sun or /data/site-d1/conf here app-d1 and site-d1 is not constant. It may be different in different files. common part is /proj/xx/sun and /data/xxx/conf i want to find where ever... (6 Replies)
Discussion started by: rbalaj16
6 Replies
BBE(1)																	    BBE(1)

NAME
bbe - binary block editor SYNOPSIS
bbe [options]... DESCRIPTION
bbe is a sed-like editor for binary files. It performs binary transformations on the blocks of input stream. OPTIONS
bbe accepts the following options: -b, --block=BLOCK Block definition. -e, --expression=COMMAND Add the COMMAND to the commands to be executed. -f, --file=script-file Add the contest of script-file to commands. -o, --output=name Write output to name instead of standard output. -s, --suppress Suppress normal output, print only block contents. -?, --help List all available options and their meanings. -V, --version Show version of program. BLOCK can be defined as: N:M Where N'th byte starts a M bytes long block (first byte is 0). :M Block length in input stream is M. /start/:M String start starts M bytes long block. /start/:/stop/ String start starts the block and block ends to string stop. /start/: String start starts the block and block will end at next occurence of start. Only the first start is included to the block. :/stop/ Block starts at the beginning of input stream (or at the end of previous block) and ends at the next occurrence of stop. String stop will be included to the block. Special value '$' of M means the end of stream. Default value for block is 0:$, meaning the whole input stream. Both start and stop strings are included to block. Nonprintable characters can be escaped as nn decimal xnn hexadecimal nnn octal Character '' can be escaped as '\'. Escape codes 'a','',' ',' ','v','f',' ' and ';' can also be used. Length (N and M) can be defined as decimal (n), hexadecimal (xn) or octal (0n) value. COMMAND SYNOPSIS
bbe has two type of commands: block and byte commands, both are allways related to current block. That means that the input stream outside of block remains untouched. Block commands D [n] Delete the n'th block. Without n, all found blocks are deleted from the output stream. I string Insert the string string before the block. A string Append the string string at the end of block. J n Skip n blocks before executing commands after this command. L n Leave all blocks unmodified starting from block number n. Affects only commands after this command. N Before printing a block, the file name in which the block starts is printed. F f Before printing a block, the input stream offset at the begining of the block is printed. f can be H, D or O for Hexadecimal, Deci- mal or Octal format of offset. B f Before printing a block, the block number is printed (first block == 1) f can be H, D or O for Hexadecimal, Decimal or Octal format of block number. > file Before printing a block, the contents of file file is printed. < file After printing a block, the contents of file file is printed. Byte commands n in byte commands is offset from the beginning of current block (starts from zero). r n string Replace bytes starting at position n with string string. i n string Insert string starting at position n. p format The contents of block is printed in format defined by format. format can have any of the formats H, D, O, A and B for Hexadecimal, Decimal, Octal, Asciii and Binary. s/search/replace/ Replace all occurrences of search with replace. y/source/dest/ Translate bytes in source to the corresponding bytes in dest. Source and dest must have equal length. d n m|* Delete m bytes starting from the offset n. If * is defined instead of m, then all bytes starting from n are deleted. c from to Convert bytes from format from to to. Currently supported formats are: BCD Binary coded decimal ASC Ascii j n Commands after the j-command are ignored for first n bytes of the block. l n Commands after the l-command are ignored from n'th byte of the block. w file Write bytes from the current block to file file. Commands before w-command have effect to what will be written. %B or %nB in file will be replaced by current block number. n in %nB is field length, leading zero in n causes the block number to be left padded with zeroes. & c Performs binary and with c. | c Performs binary or with c. ^ c Performs binary xor with c. ~ Performs binary negation. u n c All bytes from start of the block to offset n are replaced by c. f n c All bytes starting from offset n to end of the block are replaced by c. x Exchange the contents of nibbles (half an octet) of bytes. Nonvisible characters in strings can be escaped same way as in block definition strings. Character '/' in s and y commands can be any visi- ble character. Note that the D, A, I, F, B, c, s, i, y, p, <, > and d commands cause the length of input and output streams to be different. EXAMPLES
bbe -e "s/c:\temp\data1.txt/c:\temp\data2.txt/" file1 all occurences of "c: empdata1.txt" in file file1 are changed to "c: empdata2.txt" bbe -b 0420:16 -e "r 4 x12x4a" file1 Two bytes starting at fifth byte of a 16 byte long block starting at offset 0420 (octal) in file1 are changed to hexadecimal values 12 and 4a. bbe -b :16 -e "A x0a" file1 Newline is added after every block, block length is 16. SEE ALSO
sed(1). AUTHOR
Timo Savinen <tjsa@iki.fi> 2006-11-02 BBE(1)
All times are GMT -4. The time now is 08:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy