sed searches a character string for a specified delimiter character, and returns a leading or traili

Hi,

Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank.

Text file :

  "1"|"ExternalClassDEA519CF5"|"Art1"
  "2"|"ExternalClass563EA516C"|"Art3"
  "3"|"ExternalClass305ED16B8"|"Art9"
  ...
  ...

Output file :

  "1"|" "|"Art1"
  "2"|" "|"Art3"
  "3"|" "|"Art9"
  ...
  ...

Thanks in advance.

Regards,
FSPalero

Your requirements are not at all clear. The sample text file and sample output file you have shown seem to want to replace the 2nd double quoted string between vertical bar field separators with a double quoted single <space> character.

But your description says that you want to search a "character string for a specified delimiter character, and returns a leading or trailing space/blank". It doesn't say anything about replacing anything; it just requests that a leading or trailing <space> or <tab> character be returned if some unspecified single delimiter character is found.

Please clearly explain what you are trying to do AND show us (in CODE tags) what you have a tried to meet these requirements on your own.

Assuming you want the 2nd "string" substituted by a " ", and *retain* (preserve) the spaces at the very beginning and end of the line:

sed 's/"[^"]*"/" "/2' inputfile