Sponsored Content
Top Forums Shell Programming and Scripting replace word with using "sed" not work... Post 302108710 by sb008 on Wednesday 28th of February 2007 12:24:33 PM
Old 02-28-2007
Oops, I overlooked the 6-9 spaces before "<Number>"

No matter how many space in front:

Code:
# cat file
   <Number>11 48 79 74 71 47 97 F0</Number>
  <Number>11 48 79 67 64 76 63 F0</Number>
      <Number>11 48 78 91 39 26 41 F0</Number>
    <Number>11 48 78 82 43 96 22 F0</Number>
  <Number>11 50 79 56 22 16 77 F0</Number>
           <Number>11 48 79 56 22 16 77 F0</Number>
    <Number>11 48 77 15 54 00 75 F0</Number>
  <Number>11 48 79 56 22 16 77 F0</Number>
      <Number>11 48 78 91 56 76 39 F0</Number>
  <Number>11 33 06 14 24 36 26 80 F0</Number>
                 <Number>11 48 06 14 24 36 26 80 F0</Number>
   <Number>11 48 78 82 43 96 22 F0</Number>
     <Number>11 48 78 91 39 26 41 F0</Number>
  <Number>11 48 79 29 33 85 94 F0</Number>
<Number>11 20 79 46 93 73 87 F0</Number>
      <Number>11 48 79 67 64 76 63 F0</Number>
  <Number>11 21 79 74 71 47 97 F0</Number>
            <Number>11 48 79 29 33 85 94 F0</Number>
       <Number>11 00 79 67 64 76 63 F0</Number>
  <Number>11 48 06 14 24 36 26 80 F0</Number>
            <Number>11 99 79 69 08 44 09 F0</Number>
     <Number>11 48 08 52 91 83 55 71 F0</Number>
        <Number>11 48 78 41 65 21 82 F0</Number>
   <Number>11 87 77 90 77 53 88 F0</Number>
          <Number>11 48 06 14 24 36 26 80 F0</Number>
  <Number>11 77 77 02 63 52 01 F0</Number>
      <Number>11 12 79 69 08 44 09 F0</Number>
<Number>11 13 79 71 22 87 43 F0</Number>
 <Number>11 98 78 91 48 73 39 F0</Number>
   <Number>11 97 78 91 56 79 38 F0</Number>
      <Number>11 94 79 66 20 57 47 F0</Number>
<Number>11 33 77 25 99 67 03 F0</Number>

# sed -e "/^[ ]*<Number/s/ //g" -e "/^[ ]*<Number/s/\([0-9][0-9]\)./\1/" -e "/^[ ]*<Number/s/\([0-9][0-9]\)/\1 /g" -e "/^[ ]*<Number/s/0</</" file
<Number>11 87 97 47 14 79 7F</Number>
<Number>11 87 96 76 47 66 3F</Number>
<Number>11 87 89 13 92 64 1F</Number>
<Number>11 87 88 24 39 62 2F</Number>
<Number>11 07 95 62 21 67 7F</Number>
<Number>11 87 95 62 21 67 7F</Number>
<Number>11 87 71 55 40 07 5F</Number>
<Number>11 87 95 62 21 67 7F</Number>
<Number>11 87 89 15 67 63 9F</Number>
<Number>11 30 61 42 43 62 68 0F</Number>
<Number>11 80 61 42 43 62 68 0F</Number>
<Number>11 87 88 24 39 62 2F</Number>
<Number>11 87 89 13 92 64 1F</Number>
<Number>11 87 92 93 38 59 4F</Number>
<Number>11 07 94 69 37 38 7F</Number>
<Number>11 87 96 76 47 66 3F</Number>
<Number>11 17 97 47 14 79 7F</Number>
<Number>11 87 92 93 38 59 4F</Number>
<Number>11 07 96 76 47 66 3F</Number>
<Number>11 80 61 42 43 62 68 0F</Number>
<Number>11 97 96 90 84 40 9F</Number>
<Number>11 80 85 29 18 35 57 1F</Number>
<Number>11 87 84 16 52 18 2F</Number>
<Number>11 77 79 07 75 38 8F</Number>
<Number>11 80 61 42 43 62 68 0F</Number>
<Number>11 77 70 26 35 20 1F</Number>
<Number>11 27 96 90 84 40 9F</Number>
<Number>11 37 97 12 28 74 3F</Number>
<Number>11 87 89 14 87 33 9F</Number>
<Number>11 77 89 15 67 93 8F</Number>
<Number>11 47 96 62 05 74 7F</Number>
<Number>11 37 72 59 96 70 3F</Number>

 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can "sed" substitute word on a specific line?

Hello experts, I know line number of the word I want to replace. Can "sed" substitute word on a specific line? As well, can sed substitute words inside a specific patten. ex. <word>lalala</word> #replace anything between <word> and </word> minifish (2 Replies)
Discussion started by: minifish
2 Replies

2. Shell Programming and Scripting

Extract Part of a "Word", using AWK or SED????

I have been lurking on this forum for some time now and appreciate Everyone's help. I need to find a way to get the SystemID from this XML file. The file is much larger than just this one line but I can grep and get this line Printed. But really just need the "systemid". <test123: prefintem... (9 Replies)
Discussion started by: elbombillo
9 Replies

3. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

4. Shell Programming and Scripting

Interesting question - Search and replace the word after sign "="

Hi Guys, Req your help in searching and replacing the word that comes after equals(=) symbol I would like to replace the sting in bold with a string in variable. d=ABCDF8C44C22 # grep -i NIM_MASTERID ${_NIMINFO} export NIM_MASTERID=00CDF8C44C00 I'm looking to replace any word that... (4 Replies)
Discussion started by: ajilesh
4 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

7. Shell Programming and Scripting

How do i replace a word ending with "key" using awk excpet for one word?

echo {mbr_key,grp_key,dep_key,abc,xyz,aaa,ccc} | awk 'gsub(/^|abc,|$/,"") {print}' Required output {grp_key,xyz,aaa,ccc} (5 Replies)
Discussion started by: 100bees
5 Replies

8. Shell Programming and Scripting

Add the word "prefix" to beginning of line using sed

SUSE linux bash shell this works test -d /tmpp && echo "directory exists" || echo "directory doesn't exists" |sed -e "s/^/prefix /" prefix directory doesn't exists but why doesn't this work? test -d /tmp && echo "directory exists" || echo "directory doesn't exists" |sed -e... (3 Replies)
Discussion started by: snoman1
3 Replies
gnomevfs-cat(1) 						   User Commands						   gnomevfs-cat(1)

NAME
gnomevfs-cat - print a file to standard output using the VFS system SYNOPSIS
gnomevfs-cat URI DESCRIPTION
gnomevfs-cat is obsolete. It has been superseded by gvfs-cat. See gvfs-cat(1). gnomevfs-cat prints a file to standard output using the virtual file system to access the file via a URI. OPERANDS
The following operands are supported: URI Specifies the file location in standard URI format. EXAMPLES
Example 1: Cat a File From a Web Server example% gnomevfs-cat http://www.sun.com Example 2: Cat a Local File example% gnomevfs-cat file:///home/user/README.txt ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: NLSPATH. EXIT STATUS
The exit value 0 is returned regardless of success or failure. FILES
The following files are used by this application: /usr/bin/gnomevfs-cat Executable to print a file to standard output using the VFS system ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-vfs | +-----------------------------+-----------------------------+ |Interface stability |Obsolete Volatile | +-----------------------------+-----------------------------+ SEE ALSO
gnomevfs-copy(1), gnomevfs-info(1), gnomevfs-ls(1), gnomevfs-mkdir(1), gvfs-cat(1), attributes(5), environ(5) NOTES
Written by Stephen Browne, Sun Microsystems Inc., 2004. SunOS 5.11 14 May 2008 gnomevfs-cat(1)
All times are GMT -4. The time now is 06:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy