I have create a report and have converted the text output to HTML but in the output there is a sentence "The transaction was aborted by the user.", the spaces between this sentence is considered as separate column.
How can I overcome the same?
I am providing my code, text output and HTML output.
Code my using
Text out put
HTML output Image is attached
Moderator's Comments:
Seriously: Please use CODE tags as required by forum rules!
What is the field separator in your data file? If it's multiple spaces, it'll be difficult, as those spaces would cast / split the text as well into several fields. Can you change it, e.g. set it to <TAB> chars?
Without seeing some sample input it is impossible to test what might be going wrong, but two things seem to be problematic in your code.
Shouldn't:
be:
?
And, you can't use the default awk input field separator if something other than a single <space> character is your input field separator and there are <space> characters in your last input field. Since you haven't shown us the contents of /Reports/output/CPUAbortUser.txt we don't have any way to make a reasonable guess as to what your actual field separators are. If you would clearly define your input file format, we could help you correctly set FS or rewrite your conversion loops to use one input field for each of the first five output fields and another loop to gather the remaining input fields into a single output field for the ErrorText heading.
I will disagree slightly with RudiC about having multiple spaces as your input field separator. If your input has multiple <space> characters between fields and single <space> characters as data inside a field, you can just change the first line of your awk script from:
to:
along with the change suggested above, and everything might work for you.
Your suggestion " awk -F' +' ' " did worked properly, The column is not getting distorted but the header shifted by one column.
Please find the attached output.
Is it possible to get the header align.
Output file information:
Currently there is no delimiter in output file. The tab between column is delimiter.
I can surely insert " | "delimiter in file. Here is how the file will appear after having delimiter but the tab will still be there. I cannot get rid of tabs.
Having Tab and | delimiter is more trouble to handle.
Moderator's Comments:
Please use CODE tags (far data as well!) as required by forum rules!
The header entry WDNAME "shifts" the header fields but doesn't seem to be part of the data - where did it come from?
You are saying "The tab between column is delimiter" - does this mean there in fact ARE <TAB>s separating fields?
I created a awk state to calculate the number of success however when the query runs it has a leading zero. Any ideas on how to remove the leading zero from the calculation?
Here is my query:
cat myfile.log | grep | awk '{print $2,$3,$7,$11,$15,$19,$23,$27,$31,$35($19/$15*100)}'
02:00:00... (1 Reply)
Hi. My "/usr" folder is running out of space. My "/home" folder is quite large and has a lot of free space. As follows:
Filesystem Type Size Used Avail Use% Mounted on
...
/dev/sda5 ext3 9.7G 2.6G 6.7G 28% /
/dev/sda7 ext3 152G 16G 128G 11% /home
/dev/sda3 ... (7 Replies)
Hi,
I am trying to move a column from one position to another position in a delimited file. The positions are dynamic in nature and are available by environmental variables. Also the file can have n number of columns.
Example:
Initial Column Position=1
Final Column Position=3
Delimiter='|'
... (2 Replies)
in the same VG?
Is there a way we can do this?
We basically have a test server that used to be a production server. Now the newly created test directories have run out of space and the old production directories have alot of free space. Can we transfer that free space over?
If so how? Have... (2 Replies)
Hi All
I need to put a bunch of specific files in a directory (with loads of other files), into a tar archive. The best way I thought of doing this was putting the filenames into a file, reading them line by line in a for loop, and then adding them to a tar acrhive.
However the filenames have... (6 Replies)
Hi, I am working on transforming html code text into the .vert text format. I want to use linux utility sed. I have this regexp which should do the work: s/ \(?!*>\)/\n/g. I use it like this with sed: echo "you <we try> there" | sed 's/ \(?!*>\)/\n/g' ... The demanded output should be:
you
<we... (5 Replies)
Hi,
I use a Windows-based program called <a href="http://www.coast.com">Coast Webmaster</a> for moving large numbers of HTML files in one directory to another directory. As you drag and drop each file or entire directory of files to new locations in the web root directory tree, this utility... (1 Reply)