I need to write a BASH script that takes a 2 character string and removes the second character if it is not a digit e.g.
If the string is numberical value >9 e.g. string1 = '34' then leave string1 = '34'.
However if the string is <10 e.g. string1 = '3X' then remove the second char (which can be any character, it's whatever was in memory) so that '3X' will now be '3'.
I was thinking about using ASCII values to determine whether the second character is a number.
I wish to compute the number of dot chars in a string.
Example:
VAR="aaaa.bbbbb.cccc"
I try the shortest command to solve this test.
Thanks in advance for your help.
Regards,
Giovanni (7 Replies)
for example:
i hav a string like :
/rmsprd/arch01/rmsprd/rmsprdarch72736.log
how I can extract
my_num=72736?
I know I can
echo "/rmsprd/arch01/rmsprd/rmsprdarch72736.log" | tr "/" " " | awk '{ print $4 }' to get rmsprdarch72736.log (4 Replies)
To find out number of "|" symbol is available in file:
Input:
a|b|c|d|z
Ouput:
4
I am using below set of commands,It is working... Anybody have anyother solution using sed / awk.
cnt=`wc -c <1.txt`
cnt1=`tr -d "|" <1.txt >c.dat`
cnt2=`wc -c <c.dat`
outp=`expr $cnt... (19 Replies)
Hi!
I'm having trouble usind sed to remove the char ' from within a database's varchar register's sql.
For example, on the following sql:
INSERT INTO patrimonio_municipal.patrimonio_municipal_airc_tmp
Values('|Estação Elevatória|',|16723|,'|Grandes Reparações|',
'|2010-03-26... (3 Replies)
Hi everyone,
suppose that I have the following line:
#test your knowledge
can I use AWK to print the word "test" only? without the #?
what should I change to this:
awk '{print $1}'
thanks in advance guys (2 Replies)
Hi guys,
This is my input
2735:<7001> 34 789 701 2
2774:<7001> 34 789 701 2
How to delete characters after colon :
Including colon : too ?
My output should... (3 Replies)
I wanted to remove junk char in my csv. :mad:
Input file format:
"17","9986782190","0","D","2"
"17","9900918331","0","D","2"
"13","9986782194","0","A","2"
Output file format
9986782190
9900918331
9986782194
And one more thing all the time "13"," this will be different Ex: . (2 Replies)
hello
how can i cont number of char with loop coomand?
i dont want to use wc or other special command
the script should check all word's char. one by one
also a counter can handle the number
As noted in other threads started today. This is not the correct forum for homework assignments. ... (2 Replies)
I have a file with random characters where every time a char occurs twice, one occurrence must be removed.
Eg.
asjkdhaSSd
Must become:
asjkdhaSd
Anybody has a SED script in mind to do it? (1 Reply)
Hi I have a file where i want to remove a char before a specific pattern.
exp:
CREATE TABLE
(
A,
B,
C, ----comma needs to be removed
)AS SELECT
A,
B,
C, ----comma needs to be removed
FROM TABLE.
So i want to delete the comma(,) after the C both ways.Pattern can be... (11 Replies)
Discussion started by: raju2016
11 Replies
LEARN ABOUT OSF1
libpw
libpw(3) Library Functions Manual libpw(3)NAME
libpw, libPW, Programmers_Workbench_Library - Provides functions for compatibility with existing programs
LIBRARY
Programmers Workbench Library (libPW.a)
DESCRIPTION
The libpw functions are provided for compatibility with existing programs. Their use in new programs is not recommended. Determines
whether string contains character. Determines the offset in string1 of the first character that also occurs in string2. Determines the
offset in string of the first character in the string end that occurs outside of a balanced string as defined by open and close. Concate-
nates the source strings and copies them to destination. Defaults the cleanup routine. Puts the full pathname of the current directory in
string. Determines which directory contains the file p. General purpose error handler. Same as the stdio fdopen() function. Forces a
core dump. Determines if the string pref is an initial substring of string. Determines the offset of the first occurrence in string1 of
string2. Creates a lock file. Returns caller's login name. Copies the first n characters of string1 to string2. Converts string to
integer. Converts string to long. Sets destination to string repeated n times.
Replaces each occurrence of the character old in string with the character new.
Converts string to integer and saves it in *ip. Causes signals to be caught by the setsig1() function.
General purpose signal handling routine.
Gets a pointer to the simple name of full pathname s.
Finds the end of string. Places a substring of string s in destination using the offset origin and length. Copies string s into destina-
tion and replaces any character in old with the corresponding characters in new. Deletes the lock file. Gets the user's login directory.
Defaults user exit routine. Gets the user's login name. Determines the offset in string1 of the first character that is not also in
string2. Allocates memory. Creates a file. Frees memory.
Frees all memory.
Links files. Calls the fatal() function with an appropriate error message. Opens a file. Creates a pipe. Removes a directory entry.
Writes n bytes to the file associated with fd from buffer. Zeros n bytes starting at address p. Replaces the initial blanks with the
character '0' in string s. delim off
libpw(3)