Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank.
Text file :
Output file :
Thanks in advance.
Regards,
FSPalero
Moderator's Comments:
The last time you got one of these infractions, the note:
Quote:
Repeated refusal to use CODE tags when presenting sample input, sample output, and code segments has resulted in this user being placed in read-only mode for a while.
Continued refusal to properly format posts may result in a permanent ban from this site.To keep the forums high quality for all users, please take the time to format your posts correctly.
was included in your post when tags were added for you. And you still refuse to make any attempt to format your posts. This is your last warning, the next post from you that includes untagged sample input, sample output, or code segments will result in you being permanently banned from this site.
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.
Last edited by Don Cragun; 01-09-2017 at 06:10 AM..
Reason: Include dropped quote.
If I have a string defined as:
MyString=abcde
echo $MyString
How can I loop through it character by character? I haven't been able to find a way to index the string so that I loop through it.
shew01 (10 Replies)
hi,
when i am doing the following things getting error
Can anyone please suggest
i have a file where there is a line like the following
branch=dev sdf dev jin kilii fin kale boyle dev james dev
i want to search the existance of dev in the above line.
cat "$file" | sed -n... (8 Replies)
Hi, I am totally new to shell scripting.
I have a String "c:\working\html\index.txt.12-12-2009.bkp" I want to check if the string has more than one "." character. If it does I would like to retrieve only "c:\working\html\index.txt" i.e, discard the second occurrence of "." and the rest of the... (7 Replies)
Hi,
i have string var1=NN. Based on conditions, i have to change this first N to Y or second N to Y and send the details to other process. How to do that? This is a linux machine.
Thanks,
Selva (1 Reply)
Hello!
Please bare with me, I'm a total newbie to scripting. Here's the sudo code of what I'm trying to do:
Get file name
Does file exist?
If true
get length of file name
get network id (this will be the last 3 numbers of the file name)
loop x 2
If... (1 Reply)
Hi All,
Was wondering how I can do the following....
I have a String as follows
"ACCTRL000005022RRWDKKEEDKDD...."
This string can be in a file called tail.out or in a Variable called $VAR2
Now I have another variable called $VAR1="000004785" (9 bytes long), I need the content of... (5 Replies)
Hi there,
A total sed noob here. Is there a way using sed to delete everything before a character AND after another character on each line in a file? The deletion should also delete the indicating characters(here: an opening and a closing parenthesis).
The original file would look like... (3 Replies)
Hi ,
I have a set of files in a folder which i need to cut in to two parts....
Sample files
touch AE_JUNFOR_2014_MTD_2013-05-30-03-30-02.TXT
touch AE_JUNFOR_2014_YTD_2013-05-30-03-30-02.TXT
touch temp_AE_JUNFOR_2014_MTD_2013-05-30-03-30-02.TXT
touch... (4 Replies)