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 it.
This does not provide the effect:
I get as a result:
Neither does it work if I write
.
(Substituting "assumption" works without problems.)
Do you have any hint of how to get the sign "\n" substituted?
Second question: forcing output not to go onto new lines
I wonder if a simple way exists to tell awk to put a number of outputs onto the same line:
awk reads in from asource file a line word by word. i want to print some words, alter some and then print them, and again simply print some together with some additional information of mine ("info").
This operation acts on up to 80 words of a line. i want the out put (i.e. cleaned up words) to go on one line, without any linebreaks.
Try
Yes you can alter some words and add your info in awk. Awk reads word based on delimiter supplied to it and holds words in predefined awk variables $1, $2 ,$3... $NF.
regarding the second question: this is the code of my function (which I call as labeling(2)):
The relevant bit here is do {...}.
Thus, I want to apply this bit on each string, starting with $2 and ending with string $80.
My input looks like this:
awk transforms this now into
How would I need to rewrite this code to have as output:
Cheers!
The awk below executes and produces the current output, which is correct, except I can not seem to include the header lines # and ## in the output as well. I tried adding !/^#/ thinking that it would skip the lines with # and output them but the entire file prints as is. Thank you :).
file
... (8 Replies)
In the awk below which does execute I get output that is close, except for all the lines that start with a # are removed. Some lines have one others two or three and after the script adds the
ID= to the fields below the pattern in the awk, I can not seem to add the # lines back to the output. ... (5 Replies)
I have two large files (~250GB) that I am trying to remove the where GT: 0/0 or 1/1 or 2/2 for both files. I was going to use a bash with the below awk, which I think will find each line but how do I remove that line is that condition is found? Thank you :).
Input
20 60055 . A ... (4 Replies)
I am trying to output all lines in a file where $7 is less than 30. The below code does create a result file, but with all lines in the original file. The original file is tab deliminated is that the problem? Thank you :).
awk 'BEGIN{FS=OFS=","} $7 < 30 {print}' file.txt > result.txt... (3 Replies)
Both of these fail. One has two form feeds, the second form leaves all the backslashes.
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... (3 Replies)
Hello,
I couldn't find anything on the Forum that would help me to solve this problem. Could any body help me process below data using awk?
I have got two files:
file1:
Worker1: Thomas
Position: Manager
Department: Sales
Salary: $5,000
Worker2: Jason
Position: ... (5 Replies)
Hello Friends,
I have got, this output below and i want to extract the name of symlink which is highlighted in red and the path above it highlighted in blue. At the end i want to append path and symlink.
/var/tmp/asirohi/jdk/jre
/var/tmp/asirohi/jdk/jre/.systemPrefs... (3 Replies)
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)