Sponsored Content
Top Forums Shell Programming and Scripting To get a single string in output Post 303012201 by mirwasim on Wednesday 31st of January 2018 02:09:15 PM
Old 01-31-2018
Quote:
Originally Posted by Yoda
Ok, escape it:-
Code:
sub ( /[^\/]*\//, X, $i )

Thanks Yoda,
i have added the header also to the script you provided, it is working fine, but I am expecting to get the header over those rows for which the URL or port changes. URL will remain same for few rows and then it change, and once the URL change the header should come,
like in below input you can see the 3 record URL changed.so the header should populate over the third record(validate only server and port )

Code:
INPUT FILE:
SKILLED LANGUAGE - ENTER CREDENTIALS,You do not have skills or languages,http://xxx:7003/abc/protected/home.xhtml

NOT KNOWN - NEW VALUE,You do not have skills or languages,http://xxx:7003/abc/protected/home.xhtml
SKILLED LANGUAGE - ENTER CREDENTIALS,You do not have skills or languages,http://xxx:7005/abc/protected/home.xhtml

Code:
nawk -F, '
        BEGIN {
	        print "<html>"
                print "<body>"
                print "<table border=3>"        
                                print "<tr bgcolor=#85C1E9>"
                                print "<th>FUNCATIONALITY</th>"
                                print "<th>ERROR</th>"
                                print "<th>URL</th>"
                                print "</tr>"
        }
        {
                print "<tr>"
                for ( i = 1; i <= NF; i++ )
                {
                        if ( i == 2 )
                        {
                                sub ( /[^\/]*\//, X, $i )
                                sub ( /\//, X, $i )
                        }
                        print "<td>" $i "</td>"
                }
                print "</tr>"
        }
        END {
                print "</table>"
                print "</body>"
                print "</html>"
        }
                ' filename

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need output in different lines not in one single line

I am getting the coutput like this as show below in one single line, where as the command is executed is several lines and the output should also be requied in several lines, not in one single line. Anyone any idea? p4 opened -a | grep *locked* | awk '{ printf $8 }' >/tmp/aa $ cat... (1 Reply)
Discussion started by: csaha
1 Replies

2. AIX

ls command output in single line

Hi, Can anyone suggest me how can I display the output of ls command in single line with some delimiter say pipe (|)? I know it can be done by writing a script by using the loops but I wanted to know are there any other single line commands? Thanks for your help Sheshadri (7 Replies)
Discussion started by: arsheshadri
7 Replies

3. Shell Programming and Scripting

How to print the output in single line

Hi, Please suggest, how to get the output of below script in single line, its giving me in different lines ______________________ #!/bin/ksh export Path="/abc/def/ghi"; Home="/home/psingh/prat"; cd $Path; find $Path -name "*.C#*" -newer "abc.C#1234" -print > $Home cat $Home | while... (1 Reply)
Discussion started by: Prat007
1 Replies

4. Shell Programming and Scripting

awk: round output or delimit output of arithmatic string

I have a file with the following content. > cat /tmp/internetusage.txt 6709.296322 30000 2/7/2010 0.00I am using the following awk command to calculate a percentage from field 1 and 2 from the file. awk '{ print $1/$2*100 }' /tmp/internetusage.txt This outputs the value "22.3643" as a... (1 Reply)
Discussion started by: jelloir
1 Replies

5. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

6. Shell Programming and Scripting

How to select a single string

I am learning sed/awk. So, bear with me. I have successfully created a list (based on sed) which looks like: <cl:item href="clsysrev/XTT004/XTT05064.xml" productSubtitle="animals" unitStatus="today"IR"> <cl:item href="clsysrev/XTT007/XTT08581.xml" productSubtitle="humans"... (3 Replies)
Discussion started by: alonso_canada
3 Replies

7. Shell Programming and Scripting

Output to be in single line

Hi All, Small script but :wall:, please help in this regard. for i in 1 2 3 do echo $i done result : 1 2 3 I want the above to be printed as below expected result: 1 2 3 Thanks in advance :) (3 Replies)
Discussion started by: girish_satyam
3 Replies

8. Shell Programming and Scripting

Output to single line

Hi, I am using below command and getting below output. echo "dis ql(*) CLUSTER"|runmqsc CT.QM.ASSA10T1| egrep 'QUEUE|CLUSTER'|egrep -v 'SYSTEM|XMITQ'| sed -e 's/QUEUE(/ /g' -e 's/TYPE(QLOCAL)/ /g' -e 's/CLUSTER(/ /g' -e 's/)/ /g' output CT.CL.ALLUHUB.FLST_TO_HUB_PROV.01... (20 Replies)
Discussion started by: darling
20 Replies

9. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

10. Shell Programming and Scripting

Single grep to multiple strings with separate output per string

I need to grep multiple strings from a particular file. I found the use of egrep "String1|String2|String3" file.txt | wc-l Now what I'm really after is that I need to separate word count per each string found. I am trying to keep it to use the grep only 1 time. Can you guys help ? ... (9 Replies)
Discussion started by: nms
9 Replies
deroff(1)						      General Commands Manual							 deroff(1)

NAME
deroff - remove nroff, tbl, and neqn constructs SYNOPSIS
x] [file ...] DESCRIPTION
reads each file in sequence and removes all requests, macro calls, backslash constructs, constructs (between and lines, and between delim- iters -- see neqn(1)), and descriptions (see tbl(1)), replacing them with white space (blanks and blank lines), and writes the remainder of the file on the standard output. follows chains of included files and formatter commands); if a file has already been included, a naming that file is ignored and a naming that file terminates execution. If no input file is given, reads the standard input. The option can be followed by an or The option causes the macros be interpreted such that only running text is output (that is, no text from macro lines). The option forces the option and also causes deletion of lists associated with the macros. If the option is given, the output is a word list, one ``word'' per line, with all other characters deleted. Otherwise, the output follows the original, with the deletions mentioned above. In text, a ``word'' is any multi-byte character string or any string that contains at least two letters and is composed of letters, digits, ampersands and apostrophes In a macro call, however, a ``word'' is a multi-byte char- acter string or a string that begins with at least two letters and contains a total of at least three letters. Delimiters are any charac- ters other than letters, digits, apostrophes, and ampersands. Trailing apostrophes and ampersands are removed from ``words.'' If the option is specified, ignores the and commands. EXTERNAL INFLUENCES
Environment Variables determines the interpretation of text and filenames as single and/or multi-byte characters. Note that multi-byte punctuation characters are not recognized when using the option. determines the language in which messages are displayed. If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty variable. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See environ(5). International Code Set Support Single- and multi-byte character code sets are supported. WARNINGS
is not a complete interpreter; thus it can be confused by subtle constructs. Most such errors result in too much rather than too little output. The option does not handle nested lists correctly. AUTHOR
was developed by the University of California, Berkeley. SEE ALSO
neqn(1), nroff(1), tbl(1). deroff(1)
All times are GMT -4. The time now is 02:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy