Sponsored Content
Top Forums Shell Programming and Scripting Number of specific char in a string. Post 45246 by Ygor on Wednesday 17th of December 2003 06:25:29 AM
Old 12-17-2003
echo $VAR|awk '{print gsub("\.",0)}'
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

last char from a string

i have a script that reads a plain text file. (its a ksh, and i can use bash also) each line of the file is a fullpath of a file. that makes the list huge. i need to add a functionalitie to that script, i have to be able to add /usr/* or /usr/ and with that reference all the files and folders... (6 Replies)
Discussion started by: broli
6 Replies

2. Shell Programming and Scripting

how to get number char from a string

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)
Discussion started by: netbanker
4 Replies

3. Shell Programming and Scripting

using sed to replace a specific string on a specific line number using variables

using sed to replace a specific string on a specific line number using variables this is where i am at grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean grep -n Destination... (2 Replies)
Discussion started by: todd.cutting
2 Replies

4. Shell Programming and Scripting

To find number of char occur

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)
Discussion started by: Jairaj
19 Replies

5. Shell Programming and Scripting

Checking variable with specific string and stripping number from it.

I am parsing a file and I get differnt results everytime. Sometimes I get 12s sometimes I get 54m and sometime 3h.. v1=12s or v1=54m or v1=3h 12s - 12 seconds 54m - 54 minutes 3h - 3 hour I have to write a script in such a way that it whenever v1 is in minutes, I should strip "m"... (14 Replies)
Discussion started by: jayeshpatel
14 Replies

6. Shell Programming and Scripting

Remove only specific char on every line when exists

Hi I need to remove "|" char when it's the last char of the line. Input file: generoso|desprendido|altruista| abnegar|ceder|sacrificar| abocetado-da|esbozado| apuntado|insinuado|incompleto abocetar|esbozar|bosquejar| diseņar|delinear ------------------------ output need --- ... (11 Replies)
Discussion started by: lookoo
11 Replies

7. Shell Programming and Scripting

How count number of char?

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)
Discussion started by: nimafire
2 Replies

8. UNIX for Dummies Questions & Answers

Remove char if not a number

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... (7 Replies)
Discussion started by: millsy5
7 Replies

9. UNIX for Dummies Questions & Answers

Search for a specific String in a log file for a specific date range

Hi, I have log file which rolls out every second which is as this. HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
Discussion started by: karthikprakash
3 Replies
SYSTEMD-ACTIVATE(8)						 systemd-activate					       SYSTEMD-ACTIVATE(8)

NAME
systemd-activate - Test socket activation of daemons SYNOPSIS
/usr/lib/systemd/systemd-activate [OPTIONS...] daemon [OPTIONS...] DESCRIPTION
systemd-activate can be used to launch a socket activated daemon from the command-line for testing purposes. It can also be used to launch single instances of the daemon per connection (inetd-style). The daemon to launch and its options should be specifed after options intended for systemd-activate. If the -a option is given, file descriptor of the connection will be used as the standard input and output of the launched process. Otherwise, standard input and output will be inherited, and sockets will be passed through file descriptors 3 and higher. Sockets passed through $LISTEN_FDS to systemd-activate will be passed through to the dameon, in the original positions. Other sockets specified with --listen will use consecutive descriptors. OPTIONS
--help, -h Prints a short help text and exits. --version Prints a short version string and exits. -l address, --listen=address Listen on this address. Takes a string like "2000" or "127.0.0.1:2001". -a, --accept Launch a separate instance of daemon per connection and pass the connection socket as standard input and standard output. -E VAR[=VALUE], --environment=VAR[=VALUE] Add this variable to the environment of the launched process. If VAR is followed by "=", assume that it is a variable-value pair. Otherwise, obtain the value from the environment of systemd-activate itself. ENVIRONMENT VARIABLES
$LISTEN_FDS, $LISTEN_PID See sd_listen_fds(3). $SYSTEMD_LOG_TARGET, $SYSTEMD_LOG_LEVEL, $SYSTEMD_LOG_COLOR, $SYSTEMD_LOG_LOCATION Same as in systemd(1). EXAMPLE 1 $ /usr/lib/systemd/systemd-activate -l 2000 -a cat This runs an echo server on port 2000. EXAMPLE 2 $ /usr/lib/systemd/systemd-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd This runs a socket activated instance of systemd-journal-gatewayd(8). SEE ALSO
systemd(1), systemd.socket(5), systemd.service(5), cat(1) systemd 208 SYSTEMD-ACTIVATE(8)
All times are GMT -4. The time now is 10:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy