Sponsored Content
Full Discussion: Supress text
Top Forums Shell Programming and Scripting Supress text Post 302925081 by Don Cragun on Thursday 13th of November 2014 10:38:20 PM
Old 11-13-2014
Quote:
Originally Posted by ahmedwaseem2000
Hi,

I was looking for a simple code to suppress the text between 2 characters. the characters can be of same kind like "*" or "(" and ")". The number of characters are not consistent and could vary.

How can I suppress the text between 2 characters?

Code:
 Example:
Input : Hello (Within Bracket) Outside bracket ( within bracket)
          Hello (Open Bracket without closed
          Hello ****WORLD** 
          Hello *WORLD* 
          Hello "World"
Output: Hello Outside bracket 
           Hello 
          Hello 
          Hello 
          Hello

Your stated goals and your sample input and output do not match:
Why is:
Code:
          Hello (Open Bracket without closed

changed at all? There is no closing ")" to match the opening "(".

Why isn't:
Code:
          Hello ****WORLD**

changed to:
Code:
          Hello WORLD

The 1st and 2nd asterisks (and the empty string between them) should be removed, the 3rd and 4th asterisks (and the empty string between them) should be removed, and the 5th and 6th asterisks (and the empty string between them) should be removed; but not the "WORLD".
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Supress screen output...

I need to suppress the output to the screen. I am appending to a file so do not need the output on the screen in the CLI environment. eg. cat $HOME/somefile >> $HOME/anotherfile I am doing this a number of times with SQL output files so I can look at the finished file not on the screen in the... (3 Replies)
Discussion started by: jagannatha
3 Replies

2. UNIX for Advanced & Expert Users

Supress special chars in vi

Hi, One of our application is producing log files. But if we open the log file in vi or less or view mode, it shows all the special characters in it. The 'cat' shows correctly but it shows only last page. If I do 'cat' <file_name> | more, then again it shows special characters. ... (1 Reply)
Discussion started by: divakarp
1 Replies

3. Shell Programming and Scripting

How do I supress certian output with find?

I am using this command find . -type f -mmin "+$t" > holder Unfortunatley that is also printing files that begin with a period. Such as .bash_history. What can I do to supress files that begin with a period? (1 Reply)
Discussion started by: chrchcol
1 Replies

4. UNIX for Advanced & Expert Users

Supress error message

Hi All this is a simple script #! /bin/bash FileCnt=`ls -lrt $DIR/* | wc -l` echo $FileCnt how could i escape the error msg if there are no files in $DIR ls: /home/sayantan/test/files/cnt/*: No such file or directory 0 Looking forward for a quick reply Regards, Newbie (2 Replies)
Discussion started by: newbie07
2 Replies

5. Shell Programming and Scripting

how to supress the trace

Hi I am working in ksh and getting the trace after trying to remove the file which in some cases does not exist: $ my_script loadfirm.dta.master: No such file or directory The code inside the script which produces this trace is the following: ] || rm ${FILE}.master >> /dev/null for... (3 Replies)
Discussion started by: aoussenko
3 Replies

6. Shell Programming and Scripting

supress error messages

Hi I have a script which connects to oracle using sqlplus if ! check_sqlplus "$ORACLE_SID" ; then echo "Unable to use sqlplus for sid $ORACLE_SID" return 1 else echo "attempting to connect to database" echo $ORACLE_HOME echo $ORACLE_SID echo "Status before entering... (2 Replies)
Discussion started by: xiamin
2 Replies

7. Shell Programming and Scripting

AWk - supress warning

Hi, I am trying to run a script using awk and sed a few times. The script itself seems to work fine but in a final awk statement it throws up a warning: awk: warning: escape sequence `\.' treated as plain `.' script: ... (3 Replies)
Discussion started by: HugoDarley
3 Replies

8. Shell Programming and Scripting

To Supress *

Hi Team , I want supress the meaning of * while passing it as parameter. I have file which contains file format and destination directory. let say abc* |/home/xyz I had function which will read these values and pass it to another function. Code looks like below func1 () {... (6 Replies)
Discussion started by: gvkumar25
6 Replies

9. Shell Programming and Scripting

awk to supress error message with custom text

After a bash function is run the below file is produced: out_name.txt tab-delimeted Input Errors and warnings AccNo Genesymbol Variant Reference Sequence Start Descr. Coding DNA Descr. Protein Descr. GeneSymbol Coding DNA Descr. GeneSymbol Protein Descr. Genomic... (3 Replies)
Discussion started by: cmccabe
3 Replies

10. Shell Programming and Scripting

Supress the psswd from ps in ksh/bash

I am running the ETL job to passing the database username,pssswd positional arguments to shell script (bash) and how can we suppress/hide the password from ps command. (2 Replies)
Discussion started by: pimmit22043
2 Replies
strord(3C)																strord(3C)

NAME
strord - convert string data order SYNOPSIS
DESCRIPTION
The text orientation (mode) of a file can be right-to-left (non-Latin) or left-to-right (Latin). This text orientation can affect the way data is arranged in the file. The data arrangements that result are called screen order and keyboard order. converts the order of characters in s2 from screen to keyboard order or vice versa and places the result in s1. The arguments s1 and s2 point to strings (arrays of characters terminated by a null character). returns s1. performs the conversion based on mode information indicated by the argument m. The argument m is of type nl_mode found in the header file The mode argument can have two possible values: and If the mode argument is the text orientation is left-to-right, and all non-Latin sub-strings are reversed. Non-Latin sub-strings are any number of contiguous right-to-left language characters. Non-Latin sub-strings are delimited by ASCII characters. Similarly, if the mode argument is the text orientation is right-to-left and all Latin sub-strings are reversed. Latin sub-strings are any number of contiguous printable ASCII characters. Latin sub-strings are delimited by right-to-left language characters and ASCII control codes. Some right-to-left languages have a duplicate set of digits called alternative numbers. Alternative numbers always have a left-to-right orientation. EXTERNAL INFLUENCES
Locale The category determines whether a right-to-left language has alternative numbers. International Code Set Support Single-byte character code sets are supported. WARNINGS
does not check for overflow of the array pointed to by s1. Obsolescent Interfaces is to be obsoleted at a future date. AUTHOR
was developed by HP. SEE ALSO
forder(1), nljust(1), setlocale(3C), environ(5), thread_safety(5). TO BE OBSOLETED strord(3C)
All times are GMT -4. The time now is 12:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy