Sponsored Content
Top Forums Shell Programming and Scripting Logic to separate the first name in the file Post 302999495 by ricky-row on Wednesday 21st of June 2017 11:47:17 AM
Old 06-21-2017
No, sorry
The value of VAR should be the input of my question

---------- Post updated at 09:17 PM ---------- Previous update was at 09:06 PM ----------

Code:
test()
{
  pushd packages &>/dev/null
  mkdir -p ../info
  for p in $(ls *.rpm 2>/dev/null);do
    VAR=($(echo $p| sed 's/-[0-9].*//';))
    if [ -e /info/$VAR.list} ]; then continue;fi
      rpm -qlp $p | sed -re 's/^/./' > /info/$VAR.list};;
    esac
  done
  popd &>/dev/null
}
test

After this function, let there are 10 files with .rpm extension has been parsed and saved with $VAR.list .
Now the other function should take the all the 10 values of VAR i.e the function can be called inside the test() function.

that VAR value has to be written inside a file name test.txt
ex: $cat test.txt
NAME=abc
NAME=xyz......
 

We Also Found This Discussion For You

1. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
Excel::Template::Container::Conditional(3pm)		User Contributed Perl Documentation	      Excel::Template::Container::Conditional(3pm)

NAME
Excel::Template::Container::Conditional - Excel::Template::Container::Conditional PURPOSE
To provide conditional execution of children nodes NODE NAME
IF INHERITANCE
CONTAINER ATTRIBUTES
o NAME This is the name of the parameter to test. It is resolved like any other parameter name. (q.v. VAR for more info.) o VALUE If VALUE is set, then a comparison operation is done. The value of NAME is compared to VALUE using the value of OP. o OP If VALUE is set, then this is checked. If it isn't present, then '==' (numeric equality) is assumed. OP must be one of Perl the numeric comparison operators or the string comparison operators. All 6 of each kind is supported. Note: If you want to use < or <=, you must instead use &lt; or &lt;=. This is to make sure it will parse with XML::Parser. You should not need to use &gt; or &gt;= instead of > and >=, respectively. o IS If VALUE is not set, then IS is checked. IS is allowed to be either "TRUE" or "FALSE". The boolean value of NAME is checked against IS. CHILDREN
None EFFECTS
None DEPENDENCIES
None USAGE
<if name="__ODD__" is="false"> ... Children here </if> In the above example, the children will be executed if the value of __ODD__ (which is set by the LOOP node) is false. So, for all even iterations. AUTHOR
Rob Kinyon (rob.kinyon@gmail.com) SEE ALSO
LOOP, VAR perl v5.14.2 2010-06-17 Excel::Template::Container::Conditional(3pm)
All times are GMT -4. The time now is 03:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy