With my forum search term 'issue with leading dash' i found 2 closed threads which sadly didnt help me.
Also me was to eager to add the script, that i didnt properly test, and just now figured this issue.
So i have this code:
I had also tried line=$(echo "$line"|$SED 's|{%$/\|\}|\\&|g') but that didnt work on the {} and %
And attempting to print text like:
Now the current issue cause the most trouble is the leading - of the %changelog section.
But what i get is:
Guess i'll try now a sed instead of a substition on the first line modification, as i just want a leading dash escaped, not every dash.
If that should work, the question on % and {} remains though.
Thank you
---------- Post updated at 12:21 ---------- Previous update was at 12:09 ----------
Changed to:
But still no luck.
Oh wait... /bin/tui-printf: Zeile 354: printf
Should i attempt this in tui-printf or in tui-cat?
What troubles me the most is this (inside tui-cat):
If i dont escape the leading dash, it fails on tui-printf/printf/echo.
If i escape the leading dash, it prints the escape char too.
Confused.
---------- Post updated at 13:52 ---------- Previous update was at 12:21 ----------
Me out of ideas now, thank you in advance for any ideas.
I don't quite understand what you want. What is the difference between a leading dash, and every other dash? If you can define that precisely, you'll have mostly solved the problem.
It looks like you have some kind of home-grown library: tui-printf tui-echo
It appears not to deal with whatever you have been sending it.
I may be delusional but I think this will work:
The reason this will probably work is that you no longer have the shell intervening to mess with and get confused by } and other characters.
Note: line is also a command and it functions as read line does.
Using a command name as variable name is usually a bad idea.
You could try:
if tui-echo deal with the output.
This User Gave Thanks to jim mcnamara For This Post:
@ Corona:
The leading 'dash' produces an error like (Just the same way as printf does :: was the first/last i could find when scrolling up from yesterdays terminal output):
Obviously this error appears as many times there is a leading dash, which is required by the specfile to list items.
Though, its more thought to print 'simple' text files, rather than 'scripts' like this.
--> @ Jim: Yes.
Hope xargs preserves argument strings?
Anyway, i will see what happens.
@ MadeInGermany
The % was in some way the least of the issues , but i try it 'that' way and see if it fixes the alignment.
Thinking...
Since its tui-printf issueing the leading dash, as that indicates an option/argument for tui-printf uses getopts to parse them, it could be a good idea to catch this (the leading dash) in tui-printf.
So another, fetching wrong option to catch in a tempvar and reuse that tempvar in the final output (354) again, hopeing there will be no splitting up, though i could just pass the tempvar again, and let itself handle it again when the string matches on the line...
But first, i'll do what you suggested.
---------- Post updated at 11:43 ---------- Previous update was at 11:03 ----------
With the changes from MadeInGermany (only), i get (regardles of '%s' or "%s" or even echo -n "-teststring"):
@ Jim
Now i dont get any of the dashes to see.
They are part of the output, so i want to preserve them for the output, they just keep interfeering with:
Figured, ty M.I.G., that tui-echo didnt print "This is 100%" well, so i've added the escaping from tui-cat to tui-printf, which does the tui-echo output, which is again used by tui-cat. Easy huh
Anyway, since that works quite good, i can finaly be precice on my question:
I need to know a way so i can pass a string to a command, so it prints a leading dash without failing, give it also has the 'power' of printf.
Or something that helps to preserve the leading dash for the output, without crashing the expected output, and to print the escape char for the leading dash, as shown in first post.
Any further ideas please?
Thank you in advance.
---------- Post updated at 12:33 ---------- Previous update was at 11:43 ----------
For the leading dash, i put in a single empty spacechar and renamed line to content.
Tui-cat now uses this:
As of now, the % fix is:
So me now have only one remaining issue:
Should actualy look like (keep format/idention, show the backslash):
My best guess is (in tui-printf):
My other attempt also doesnt seem to work (in tui-cat):
But still dont even see the tailing \...
Any ideas
All- We have a performance issue in reading a file line by line. Please find attached scripts for the same. Currently it is taking some 45 min to parse "512444" lines.
Could you please have a look at it and provide any suggestions to improve the performance.
Thanks,
Balu
... (12 Replies)
Hi All- we have performance issue in unix to read line by line.
I am looking at processing all the records.
description: Our script will read data from a flat file, it will pickup first four character and based on the value it will set up variables accordingly and appended the final output to... (11 Replies)
Heyas
I'm trying to read/display a file its content and put borders around it (tui-cat / tui-cat -t(ypwriter).
The typewriter-part is a 'bonus' but still has its own flaws, but thats for later.
So in some way, i'm trying to rewrite cat using bash and other commands.
But sadly it fails on... (2 Replies)
Hi,
This is the script and the error I am receiving
Can anyone please suggest ?
For the exmaple below assume we are using vg01
#!/bin/ksh
echo "##### Max Mount Count Fixer #####"
echo "Please insert Volume Group name to check"
read VG
lvs |grep $VG | awk {'print $1'} > /tmp/audit.log
... (2 Replies)
Hi,
I'm trying to run the following command using sh -c
ie
sh -c "while read EachLine
do
rm -f $EachLine ;
done < file_list.lst;"
It doesn't seem to do anything.
When I run this at the command line, it does remove the files contained in the list so i know the command works
ie... (4 Replies)
Hi
I am using while loop, below, to read lines from a very large file, around 400,000 rows. The script works fine until around line 300k but then starts giving incorrect result.
I have tried running the script with a smaller data set and it works fine. I made sure to include the line where... (2 Replies)
I am using the while-loop to read a file.
The file has lines with null-terminated strings (words, actually.)
What I have by that reading - just a first word up to '\0'!
I need to have whole string up to 'new line' - (LF, 10#10, 16#A)
What I am doing wrong?
#make file 'grb' with... (6 Replies)
Hi,
Could someone has any suggestions on this? When read a line from a file, I need to check the first char in the line, it could be a space or any char. But the leading spaces are removed by read.
Thanks. (2 Replies)
Hi all,
I've been trying to get this to work for ages to no avail. I've searched this site and googled but cannot find a satisfactory answer.
I've got a while loop, like this
while read line
do
echo "$line"
done < file_name
Now, my problem is that most of the lines in the file... (3 Replies)