How can I get sed to include backslash and 'f' in the output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can I get sed to include backslash and 'f' in the output
# 1  
Old 03-02-2012
How can I get sed to include backslash and 'f' in the output

Both of these fail. One has two form feeds, the second form leaves all the backslashes.
Code:
bold='\(code\|command\|var\|samp\|option\|strong\)'
sed -e "s;@${bold}{"'\([^}]*\)};\fB\2\fP;g'
sed -e "s;@${bold}{"'\([^}]*\)};\\fB\2\\fP;g'

Obviously, I'm trying to change texi markup into man page markup, but it isn't working.
# 2  
Old 03-02-2012
Hi bkorb,

What should be output? I can't understand your sed command.

Regards,
Birei
# 3  
Old 03-05-2012
Quote:
Originally Posted by birei
What should be output? I can't understand your sed command.
Of course not. "sed" is a write-only language. Smilie Actually, there was a hidden layer of filtering that I couldn't see. Since everything else was working and that was not a assumed that the "\f" were processed by sed. Nope. There was another layer I didn't know about doing the "\f" -> ^L translation that was avoided by doubling the backslashes. Sorry.
Anyway, to be clear, the desired outcome is from the first expression:
Code:
$ echo '@code{foo}' | sed "$whatever"
\fBfoo\fP

The "@code{}" being a texi-ism and "\fBfoo\fP" being man page text.

---------- Post updated at 06:26 AM ---------- Previous update was at 06:21 AM ----------

editing isn't working.
Code:
sed "s/that was not a/that was not, I"

on that last post. This should be easier to read. Smilie

---------- Post updated at 06:26 AM ---------- Previous update was at 06:26 AM ----------

editing isn't working.
Code:
sed "s/that was not a/that was not, I"

on that last post. This should be easier to read. Smilie

---------- Post updated at 06:28 AM ---------- Previous update was at 06:26 AM ----------

Hmmm. This posting software needs some fixes!!!

---------- Post updated at 06:28 AM ---------- Previous update was at 06:28 AM ----------

Hmmm. This posting software needs some fixes!!!
# 4  
Old 03-05-2012
Sorry, but I understand nothing about your post.

Do you want to change @code{foo} into \fBfoo\fP using sed?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Include pathname in awk output?

I am running an awk to verify all the memory settings for tomcat, and need to include path or directory in output .... I am running: awk '{ print $3 }' /opt/dir1/dir2/*/tomcat/bin/setenv.sh Output results: -Xms1024m -Xmx1536m -Xmx1536m -Xmx1024m -Xms1024m -Xms1024m -Xms512m -Xms1024m... (3 Replies)
Discussion started by: kgolli
3 Replies

2. Shell Programming and Scripting

Adding a backslash in front of square brackets with sed

I'm trying to convert this line: to \ with sed. This is what I have so far: sed -e 's/\]*\)\]/\\\\\/' but this still gives me . Any suggestions? (15 Replies)
Discussion started by: lehaste
15 Replies

3. UNIX for Dummies Questions & Answers

Replace backslash at the end of the string using sed command

I have text file which is a tab delimited one. Sample data from the file is shown below: unix is\ great\ os linux\ is superb I want to replace that backslash with empty string preserving the tab delimiter. Output should be unix is great os linux is ... (3 Replies)
Discussion started by: p.akhilreddy4u
3 Replies

4. Shell Programming and Scripting

Cut on last backslash on hyperlink string-sed/awk??

hyper link- abc:8081/xyz/2.5.6/rtyp-2.5.6.jar Needs to get "rtyp-2.5.6.jar" i.e character after last backslash "/" how to do this using sed/awk?? help is highly appreciated. (7 Replies)
Discussion started by: kkscm
7 Replies

5. Shell Programming and Scripting

SED script to backslash special characters

I have a shell script that I have written to be a kind of to-do/notepad that's quickly executable from the command line. However, special characters tend to break it pretty well. Ie: "notes -a This is an entry." works fine. "notes -a This is (my) entry." will toss back a bash syntax error on... (5 Replies)
Discussion started by: skylersee
5 Replies

6. Shell Programming and Scripting

sed variable and backslash

I am trying to write a bash shell script, which extracts a sentence from a dynamically created dynamic file and passes it as a variable to sed and uses that sentence as a starting point to pull the content from a log file. the key part of the script is this key=`cat /tmp/dynamic` sed -n... (3 Replies)
Discussion started by: fedora
3 Replies

7. UNIX for Dummies Questions & Answers

AWK: Backslash \ and forcing output not to go onto new lines

Dear all, I am using Mac OSX, have been successfully written an awk script during the last days. I use the script to convert parts of a .dot-file into graphml code. First question: Backslash My .dot-code includes repeatedly the sign "\n". I would like to search for this sign and substitute... (4 Replies)
Discussion started by: ingli
4 Replies

8. Shell Programming and Scripting

How to use backslash and variables in sed

I have a line that contains backslashes in which I want sed to substitute text with variables. The line; \\s008\2033330user$ I want to change this in \\s008.ourschool.com\2033330user$ I now use this script: USER=2033330user sed 's/\\'"$USER"'/.ourschool.com\\'"$USER/" This doesn't... (3 Replies)
Discussion started by: Tubbie
3 Replies

9. Shell Programming and Scripting

Non-inserting backslash in sed statement

#!/bin/bash wget -O tmp.tmp "YouTube - Pretty Woman- Vivian's Goes Shopping!" temp=`grep 'one&video_id=' tmp.tmp | sed "s/.*one&video_id=\(.*\)'\;.*/\1/"` temp="http://www.youtube.com/get_video?video_id=$temp" temp=`echo $temp|sed -n "s/!/\\!/p"` echo " -O $filename \"$temp\"" Output:... (3 Replies)
Discussion started by: kds1398
3 Replies

10. Shell Programming and Scripting

Sed and awk backslash characters

Hi, I have a variable read from user input: PROFILESROOTDIR="\\194.185.82.188\CMSRepository\EncodingProfiles" awk -F"=" -v gr=$PROFILESROOTDIR '/ProfilesRootDirectoryFromXOEMachine/{$2=gr;}1' OFS="=" $CFGFILE > "${CFGFILE}_new" For this awk to work properly I need to replace in the... (7 Replies)
Discussion started by: potro
7 Replies
Login or Register to Ask a Question