Sponsored Content
Full Discussion: how to remove a substring
Top Forums Shell Programming and Scripting how to remove a substring Post 302336340 by samtekdallas on Tuesday 21st of July 2009 11:34:07 PM
Old 07-22-2009
Awesome! Thank you.

Could you please do another favor. By using your command, i am trying to store the value into a variable, but it seems it is not going Could you please see how can i do so.

As per the following code I am reading file .activate_ver and replace the string stored into it. But myAppWebVersion is still empty.


bash-4.0$ more .activate_ver
v6.5.2.1p001C_MR1

bash-4.0$ more test.sh
#!/bin/sh
cat ./.activate_ver | awk -F[p_] '{print $1"_"$NF}' | sort > myAppWebVersion
echo "version is $myAppWebVersion"

bash-4.0$ test.sh
version is
bash-4.0$



IF YOU CAN COULD YOU PLEASE ALSO EXPLAIN ME awk -F[p_] '{print $1"_"$NF}' COMMAND.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

substring

Hi, I have a value of a filepath in a variable DATAFILE with value as "customtop/gpsore37/gepspo/1.0/bin/ashoka.csv ". Now i want the value of last 4 charcters in to another variable. That is EXTENSION = .csv How can i do this in Shell scripting Thanks in advance Alla Kishore (8 Replies)
Discussion started by: alla.kishore
8 Replies

2. Shell Programming and Scripting

Substring HELP!

Hi, I am trying to do something which I thought was very simple but still being a beginner, has proved not to be. Input: val1 val2 val3 val4 val5 val6 . . . etc Desired Output: Every row in which value of val6 is a number starting with 0.0 or contains a capital E. The input... (2 Replies)
Discussion started by: awknerd
2 Replies

3. UNIX for Dummies Questions & Answers

Need help with substring

I need to check the occurrence of one string within another. code ******************** if ;then do something done ******************** Thanks (7 Replies)
Discussion started by: w020637
7 Replies

4. Shell Programming and Scripting

substring

I have a string '<Hi>abc</Hi>" How to print "abc" (6 Replies)
Discussion started by: sandy1028
6 Replies

5. UNIX for Dummies Questions & Answers

Getting Substring

Hi, I hav a string lets say aa.txt:bb:txt length of the string can vary.. I have to keep the token inside a array and the delimiter is : plz send me the code (2 Replies)
Discussion started by: Deekay.p
2 Replies

6. Shell Programming and Scripting

how to remove this substring?

Hello, I need to remove a substring from a string in a ksh script, the string is like this: LOCATION=+DATADG1/CMSPRD1/datafile/system.235.456721 or LOCATION=/u03/oradata/CMSPRD/SYSTEM.dbf I need to strip the last file name from that path, and get: +DATADG1/CMSPRD1/datafile or,... (8 Replies)
Discussion started by: seafan
8 Replies

7. Shell Programming and Scripting

Remove a substring from string

Good morning friends, how can i remove a string with linux scripting from a file? In specific i want to remove from a file all the tweet names and links eg @aerta and links such as http://dst.co/pIiu3i9c Thanx!!! (4 Replies)
Discussion started by: paladinaeon
4 Replies

8. Shell Programming and Scripting

Using sed, awk or perl to remove substring of all lines except the first

Greetings All, I would like to find all occurences of a pattern and delete a substring from the all matching lines EXCEPT the first. For example: 1234::group:user1,user2,user3,blah1,blah2,blah3 2222::othergroup:user9,user8 4444::othergroup2:user3,blah,blah,user1 1234::group3:user5,user1 ... (11 Replies)
Discussion started by: jacksolm
11 Replies

9. UNIX for Dummies Questions & Answers

Remove when substring meets condition

Hi Masters, I need to remove lines when date format is below certain date My file input 20140906|ALASKA|USASEL|TARPUNG|2014-03-01|82176614040|20|1 20140906|ALASKA|USATENG|CRUIEX|2014-08-01|81267079997|5|0 20140906|ALASKA|USASEL|CRUIEMBANG|2013-10-01|82280779814|9|0... (4 Replies)
Discussion started by: radius
4 Replies

10. Shell Programming and Scripting

Remove lines matching a substring in a specific column

Dear group, I have following input text file: Brit 2016 11 18 12 00 10 1.485,00 EUR Brit 2016 11 18 12 00 10 142,64 EUR Brit 2016 11 18 12 00 10 19,80 EUR Brit 2016 11 18 12 00 10 545,00 EUR Brit 2016 11 18 12 00 10 6.450,00 EUR... (3 Replies)
Discussion started by: gfhsd
3 Replies
NPM-RUN-SCRIPT(1)														 NPM-RUN-SCRIPT(1)

NAME
npm-run-script - Run arbitrary package scripts SYNOPSIS
npm run-script <command> [--silent] [-- <args>...] alias: npm run DESCRIPTION
This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts. run[-script] is used by the test, start, restart, and stop commands, but can be called directly, as well. When the scripts in the package are printed out, they're separated into lifecycle (test, start, restart) and directly-run scripts. As of ` https://blog.npmjs.org/post/98131109725/npm-2-0-0, you can use custom arguments when executing scripts. The special option -- is used by getopt https://goo.gl/KxMmtG to delimit the end of the options. npm will pass all the arguments after the -- directly to your script: npm run test -- --grep="pattern" The arguments will only be passed to the script specified after npm run and not to any pre or post script. The env script is a special built-in command that can be used to list environment variables that will be available to the script at run- time. If an "env" command is defined in your package, it will take precedence over the built-in. In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix. For example, if there is a devDependency on tap in your package, you should write: "scripts": {"test": "tap test/*.js"} instead of "scripts": {"test": "node_modules/.bin/tap test/*.js"} to run your tests. The actual shell your script is run within is platform dependent. By default, on Unix-like systems it is the /bin/sh command, on Windows it is the cmd.exe. The actual shell referred to by /bin/sh also depends on the system. As of ` https://github.com/npm/npm/releases/tag/v5.1.0 you can customize the shell with the script-shell configuration. Scripts are run from the root of the module, regardless of what your current working directory is when you call npm run. If you want your script to use different behavior based on what subdirectory you're in, you can use the INIT_CWD environment variable, which holds the full path you were in when you ran npm run. npm run sets the NODE environment variable to the node executable with which npm is executed. Also, if the --scripts-prepend-node-path is passed, the directory within which node resides is added to the PATH. If --scripts-prepend-node-path=auto is passed (which has been the default in npm v3), this is only performed when that node executable is not found in the PATH. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install, just in case you've forgotten. You can use the --silent flag to prevent showing npm ERR! output on error. You can use the --if-present flag to avoid exiting with a non-zero exit code when the script is undefined. This lets you run potentially undefined scripts without breaking the execution chain. SEE ALSO
o npm help 7 scripts o npm help test o npm help start o npm help restart o npm help stop o npm help 7 config January 2019 NPM-RUN-SCRIPT(1)
All times are GMT -4. The time now is 10:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy