Sponsored Content
Top Forums Shell Programming and Scripting Renaming files by matching info from a separate file Post 302417271 by Demosthenes on Thursday 29th of April 2010 03:57:03 AM
Old 04-29-2010
Quote:
Originally Posted by frans
The problem should come from the formatting of the 'episodes' file. Is it Tab, single space or whatever else separated ?
Tab separated.

I hadn't thought of that affecting it as my tests with awk always seemed to show the right data... Should I be converting it to comma or single space or what?

How can I tell from those scripts which format they are looking for? (so I can always know in the future).

Thanks.

Edit: I have since attempted this with comma and single space delimiters to the exact same effect. Is there something else in the formatting I should be looking at? I've just been doing a simple: :%s/^I/ /g and the like.

Last edited by Demosthenes; 04-29-2010 at 05:10 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Break a file into separate files

Hello I am facing a scenario where I have a file with XML content and I am running shell script over it. But the problem is the XML is getting updated with new services. In the below scenario, my script takes values from the xml file from one service name say ABCD. Since there are multiple, it is... (8 Replies)
Discussion started by: chiru_h
8 Replies

2. Shell Programming and Scripting

Matching a string (zip code) from a list in a separate file

I have a list of postal addresses and I need to pull the records that match a list of zip codes in a separate file. The postal addresses are fixed width. The zip code is located in character position 149-157. Something better than: cat postalfile.txt | grep -f zipcodes.txt would be great. $... (8 Replies)
Discussion started by: sitney
8 Replies

3. Shell Programming and Scripting

Splitting text file into 2 separate files ??

Hi All, I am new to this forumn as well to the UNIX, I have basic knowledge of UNIX which I studied some years ago, now I have to do some shell scripting to load data into Oracle database using sqlldr utility, whcih I am able to do. I have a requirement where I need to do following operation. I... (10 Replies)
Discussion started by: shekharjchandra
10 Replies

4. UNIX for Dummies Questions & Answers

Renaming files in one file from names in other

Hi Guys, I have a small problem of renaming multiple files. For example I have names of a set of files in one directory like K2_34625-34675 K7_988963-988983 K12_773882-7734102 and the other set corresponding to the same is U_P_321_9_3_11.ab1 U_P_322_9_3_11.ab1 U_P_323_9_3_11.ab1 Now... (23 Replies)
Discussion started by: pawannoel
23 Replies

5. Shell Programming and Scripting

matching and extracting info from text files

Hi all, I have two .txt file i.e. First text file: 2 4 1 4 Second text file 2 1.nii.gz 4 334.nii.gz 1 12.nii.gz 4 134.nii.gz If entry in 1st column of 1st text file matches the 1st column of 2nd text file, then copy the file (name of which is the second column) associated with... (4 Replies)
Discussion started by: vd24
4 Replies

6. Shell Programming and Scripting

How to split a data file into separate files with the file names depending upon a column's value?

Hi, I have a data file xyz.dat similar to the one given below, 2345|98|809||x|969|0 2345|98|809||y|0|537 2345|97|809||x|544|0 2345|97|809||y|0|651 9685|98|809||x|321|0 9685|98|809||y|0|357 9685|98|709||x|687|0 9685|98|709||y|0|234 2315|98|809||x|564|0 2315|98|809||y|0|537... (2 Replies)
Discussion started by: nithins007
2 Replies

7. Shell Programming and Scripting

HELP: Shell Script to read a Log file line by line and extract Info based on KEYWORDS matching

I have a LOG file which looks like this Import started at: Mon Jul 23 02:13:01 EDT 2012 Initialization completed in 2.146 seconds. -------------------------------------------------------------------------------- -- Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies

8. Shell Programming and Scripting

grepping files and then renaming file

Hi, What is the easiest way to list a directory with 1000s of filenames, grep it for a certain sequence of numbers, and if found to rename the file by the value you are grepping. eg The file I am examining will looks like this: 1234 1224343 2324 244 35665 If I am examining a list... (1 Reply)
Discussion started by: mantis
1 Replies

9. Shell Programming and Scripting

Renaming the file name for n number of files

Hi , I am kind of new to shell scripting and found a situation to handle ... I have few files which will be ftpd in to our sustem , the file names needs to be renamed based on condition. ------------ Eg file names :- AE_JUNFOR_2013_MTD_2013-04-09-08-30-09.TXT... (6 Replies)
Discussion started by: chillblue
6 Replies

10. Shell Programming and Scripting

Print the overlapping entries in 2 files to separate file

I have two files that contain overlapping positions. i want to put them together each overlapping entries in both files in to a new file (the entries of first file first and the entries of second file next) followed by blank line then next overlapping entries and so on. input1 chr1 22 ... (10 Replies)
Discussion started by: raj_k
10 Replies
NODEATTR(1)							     NODEATTR							       NODEATTR(1)

NAME
nodeattr - query genders file SYNOPSIS
nodeattr [-f genders] [-q | -c | -n | -s] [-X exclude_query] query nodeattr [-f genders] [-q | -c | -n | -s] -A nodeattr [-f genders] [-v] [node] attr[=val] nodeattr [-f genders] -Q [node] query nodeattr [-f genders] -V [-U] attr nodeattr [-f genders] -l [node] nodeattr [-f genders] -k nodeattr [-f genders] -d genders nodeattr [-f genders] --expand nodeattr [-f genders] --compress DESCRIPTION
When invoked with the -q , -c , -n , or -s arguments, nodeattr reads the genders file and outputs a list of nodes that match the specified query. The nodes are listed in hostlist format, comma separated lists, newline separated lists, or space separated lists respectively. Genders queries will query the genders database for a set of nodes based on the union, intersection, difference, or complement of genders attributes and values. The set operation union is represented by two pipe symbols ('||'), intersection by two ampersand symbols ('&&'), difference by two minus symbols ('--'), and complement by a tilde ('~'). Parentheses may be used to change the order of operations. The -X argument and query can be used to exclude nodes from the resulting output. A query can be replaced with the -A option to cause nodeattr to print all the nodes listed in the genders database. When called with a node name (optional) and attribute name, nodeattr returns 0 to the environment if the node has the attribute; else 1. If -v is present, the attribute name and any value (see below) is printed on the standard output. If a node name is not specified, the local host is assumed. When called with the -Q argument, nodeattr will check if the node name (optional) is met by the attribute and value conditions specified in the query. If the conditions are met, nodeattr returns 0 to the environment; else 1. The query format is identical to the format listed above. If a node name is not specified, the local host is assumed. The -V option causes nodeattr to print all of the values that exist for a particular attribute. Also specifing -U with -V causes nodeattr to print out only unique values for the particular attribute. The -l option causes nodeattr to print the attributes of the specified node. If no node is listed, all attributes in the genders file are listed. The -k option checks the genders file for parse errors and proper formatting. If errors are found, information about the error will be output to standard error. Nodeattr will always check the default genders file, but a different genders file can be specified with the -f option. The -d option allows the specified genders database to be compared to the filename indicated by the -f option or the default genders data- base. The differences contained in the specified database will be output to standard error. The --expand option will take a genders database, expand all hostranges, and output a new genders database. The subsequent database will be identical to the first, but every node will be listed on a separate line. This option may be useful for debugging or determining the difference between databases. The --compress is opposite of the --expand option. It will output a new identical genders database with hostranges of nodes with identical attributes. Depending on the setup of your genders database, the resulting database may be longer or shorter. This option may be useful as a beginning step to compressing an existing genders database. Attribute names may optionally appear in the genders file with an equal sign followed by a value. Nodeattr ignores these values except when the -v option requests that the value, if any, be displayed; and when an attribute is specified on the command line with a value, in which case only an attribute with the specified value in the genders file will match. EXAMPLES
Retrieve a comma separated list of all login nodes: nodeattr -c login Retrieve a hostlist formatted list of all login nodes: nodeattr -q login Retrieve a comma separated list of nodes with 4 cpus: nodeattr -c cpus=4 Retrieve a comma separated list of all login and management nodes: nodeattr -c "login||mgmt" Retrieve a comma separated list of all login nodes with 4 cpus: nodeattr -c "login&&cpus=4" Retrieve a comma separated list of all nodes that are not login or management nodes: nodeattr -c "~(login||mgmt)" To use nodeattr with pdsh to run a command on all fddi nodes: pdsh -w`nodeattr -c fddi` command To use nodeattr in a ksh script to collect a list of users on login nodes: for i in `nodeattr -n login`; do rsh $i who; done To verify whether or not this node is a head node: nodeattr head && echo yes To verify whether or not this node is a head node and ntpserver: nodeattr -Q "head&&ntpserver" && echo yes FILES
/etc/genders SEE ALSO
libgenders(3) LLNL
August 2003 NODEATTR(1)
All times are GMT -4. The time now is 06:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy