Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Output path for file from search file Post 302996742 by UN007 on Monday 1st of May 2017 04:52:41 PM
Old 05-01-2017
Output path for file from search file

Hello Everyone,

I am new to Unix and trying to learn as much as I can. But I do not need to create urgent scripts that I can use instantly. SmilieSmilie

One of the scripts I am trying to write is essentially something that takes in a .txt file with product names.

The product names are looked up in various directories and folders to find the file with .xls extension and outputting the full extension path against each of the input file.

e.g: The input file : Beer_names.txt (consisting of various names of beers), for this I will take Duos.

It looks up throughout the directories and folders to find the Duos.xls file and outputs the exact location of the file.

In this case the output could be something like:
Code:
sgfs/beer_strength/2041343_newmalt/Brewer_3422E23/05012017_rensn/Results/Duos.xls

As of now I have to individually search and locate each of the locations and copy the file paths. Can this be made as script???

Thank you,
un007
Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, sample output, and code segments.

Last edited by Don Cragun; 05-01-2017 at 09:38 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk script to search an html file and output links

hello. i want to make an awk script to search an html file and output all the links (e.g .html, .htm, .jpg, .doc, .pdf, etc..) inside it. also, i want the links that will be output to be split into 3 groups (separated by an empty line), the first group with links to other webpages (.html .htm etc),... (8 Replies)
Discussion started by: kyris
8 Replies

2. Shell Programming and Scripting

Input file redirect in output path and want name as inputfilename_new.txt

not required this time (6 Replies)
Discussion started by: Sandeep_Malik
6 Replies

3. Shell Programming and Scripting

Search and find the string and output to a new file.

Hi I want to search the following in the entire file and put them in a diff file. file 1 contains : Non error probabilities are not decreasing in curve 1GEORGE_SGD_SUB Mid Point RESCAP_SGD_SNU curve have errors Non default probabilities are not decreasing in curve ABF_JPY_SUB Mid Point... (3 Replies)
Discussion started by: szchmaltz
3 Replies

4. Shell Programming and Scripting

Trouble with a file path as awk output in for loop

When I run the following command in the shell it works fine. It prints a city name and then a path for a file. ~$ for i in `awk -F':' '{print $0}' /home/knoppix/Desktop/data/subs | grep -m 1 $ city | sed "s/:/ /"` >do >echo $i >done Now, when I place it in this shell script (sh) it prints... (6 Replies)
Discussion started by: afroCluster
6 Replies

5. Shell Programming and Scripting

Using awk to when reading a file to search and output to file

Hi, I am not sure if this will work or not. I am getting a syntax error. I am reading fileA, using an acct number field trying to see if it exists in fileB and output to new file. Can anyone tell me if what I am doing will work or should I attempt it another way? Thanks. exec < "${fileA}... (4 Replies)
Discussion started by: ski
4 Replies

6. Shell Programming and Scripting

How to search/replace a directory path in a file using perl

Hello All, Here is what I am trying to do and maybe you guys can point me in the right direction. I have a file that contains the following string(s): WARNING: </d1/test/program1> did not find item1 WARNING: </d1/test/program1> item1 does not exist WARNING: </d1/test/program2> item1 failed... (1 Reply)
Discussion started by: maxshop
1 Replies

7. Shell Programming and Scripting

Recursive file processing from a path and printing output in a file

Hi All, The script below read the path and searches for the directories/subdirectories and for the files. If files are found in the sub directories then read the content of the all files and put the content in csv(comma delimted) format and the call the write to xml function to write the std... (1 Reply)
Discussion started by: Optimus81
1 Replies

8. Shell Programming and Scripting

Search for a word in file and output to another

Hello Experts! I am trying to perform a common task, searching data from within a file and placing what is found into another.However, I have not been able to figure the “How to” with this situation. I need to search through all lines within this text and pull the first positional attributes... (5 Replies)
Discussion started by: leepet
5 Replies

9. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies

10. UNIX for Beginners Questions & Answers

Search of multiple numeric entries in an output file

Hello Tech Guys, I have two files named check.txt and output.txt Content of check.txt 620070527336551 40201800027285 620070551928314 40201800027285 620070534376312 40201800027285 620070536668046 02711306140261 620070248491123 02711306140261 620070553851296 02711306140261... (4 Replies)
Discussion started by: Xtreme
4 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:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy