Sponsored Content
Top Forums Shell Programming and Scripting Creating variable by for loop Post 302593721 by aksijain on Saturday 28th of January 2012 08:14:02 AM
Old 01-28-2012
you can use while loop if you want to input all to some script...
Code:
while read var
do
  thing-to-be-done
done < file-name

Or if you just want to print them :

Use :
Code:
sed -n <line to be printed>p file-name


Last edited by Franklin52; 01-28-2012 at 10:22 AM.. Reason: Please use code tags for code and data samples, thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Creating loop for a script -Perl

Hi Guyz I designed a script that can compare 2 columns(values) of single file and gives the closest numbers to the first column by comparing the numbers in first column with second and it works in a single file. Now I'm trying to design a new script with 2 objectives for 2 files (not a single... (4 Replies)
Discussion started by: repinementer
4 Replies

2. Shell Programming and Scripting

redirecting output and creating condition for while loop.

I have 2 questions. 1) Is there a means of directing output to a file (">") while making it still output to the console? I have a script that calls another lengthy script. 2) I can direct the output of the lengthy script and grep it for the words "good" or "bad" to know if I need the run... (2 Replies)
Discussion started by: mrwatkin
2 Replies

3. Shell Programming and Scripting

Creating a loop in csh

I have the following code and want to use a loop to output the results to the fparams file. if ($optparams == 1) then # Set the tdarwin parameters set txt01 = "Call to raytrac.csh" set txt02 = "" set txt03 = "./Scripts/raytrac.csh $*" set txt04 = "" set txt05 =... (0 Replies)
Discussion started by: kristinu
0 Replies

4. UNIX for Dummies Questions & Answers

creating shell loop homework help

Hello, i am new to unix and i had done very little assignment in unix. I need help on a homework assignment where i am require to create my own file call myshell. In the file it must have the commands that loop. Instead of displaying a regular command path like my computer name instead it is... (1 Reply)
Discussion started by: megaearth77
1 Replies

5. UNIX for Dummies Questions & Answers

Creating a loop to go through grep output

I'm doing this script in my Unix class and I've come to a roadblock. The purpose of this script is to search users directories for files that contain bad words i.e kill murder bomb etc., and then be able to ignore legitimate files with each use. I got the searching and ignoring part down but now... (1 Reply)
Discussion started by: jrod44
1 Replies

6. Shell Programming and Scripting

[SHELL: /bin/sh] For loop using variable variable names

Simple enough problem I think, I just can't seem to get it right. The below doesn't work as intended, it's just a function defined in a much larger script: CheckValues() { for field in \ Group_ID \ Group_Title \ Rule_ID \ Rule_Severity \ ... (2 Replies)
Discussion started by: Vryali
2 Replies

7. Shell Programming and Scripting

Array Variable being Assigned Values in Loop, But Gone when Loop Completes???

Hello All, Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....? I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping through a string containing some of these "Illegal Characters". Now... (5 Replies)
Discussion started by: mrm5102
5 Replies

8. Shell Programming and Scripting

[Solved] How to increment and add variable length numbers to a variable in a loop?

Hi All, I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies

9. Shell Programming and Scripting

Creating a loop for multiplying columns

I have 2 files, that look like this: ID SNP1 SNP2 SNP3 SNP4 A1 1 2 0 2 A2 2 0 1 1 A3 0 2 NA 1 A4 1 1 0 2 and this: SNP score SNP1 0.5 SNP2 0.7 SNP3 0.8 SNP4 0.2 Basically, all of the SNP-values are 0,1, 2 or NA, and they each have a score, listed in the second file. The total... (5 Replies)
Discussion started by: kayakj
5 Replies

10. Shell Programming and Scripting

Creating new file inside a for loop

Hi, I have list of files present in a folder. I want to search for a particular keyword sequentially and create a file which will be later used by some other program. Input files: $ ls a.dsx b.dsx c.dsx Dataline_.txt Dataline.txt loop.sh $ cat *.dsx help tyiis global for i in... (4 Replies)
Discussion started by: mac4rfree
4 Replies
__gnu_pbds::detail::left_child_next_sibling_heap_const_itera__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >(3cxx)

NAME
__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc > - SYNOPSIS
Inherits __gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc >. Public Types typedef base_type::const_pointer const_pointer typedef base_type::const_reference const_reference typedef _Alloc::difference_type difference_type typedef std::forward_iterator_tag iterator_category typedef base_type::pointer pointer typedef base_type::reference reference typedef base_type::value_type value_type Public Member Functions left_child_next_sibling_heap_const_iterator_ (node_pointer p_nd) left_child_next_sibling_heap_const_iterator_ () left_child_next_sibling_heap_const_iterator_ (const left_child_next_sibling_heap_const_iterator_< Node, _Alloc > &other) bool operator!= (const left_child_next_sibling_heap_const_iterator_< Node, _Alloc > &other) const bool operator!= (const left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc > &other) const const_reference operator* () const left_child_next_sibling_heap_const_iterator_ < Node, _Alloc > & operator++ ()" left_child_next_sibling_heap_const_iterator_ < Node, _Alloc > operator++ (int)" const_pointer operator-> () const bool operator== (const left_child_next_sibling_heap_const_iterator_< Node, _Alloc > &other) const bool operator== (const left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc > &other) const Public Attributes node_pointer m_p_nd Detailed Description template<typename Node, typename _Alloc>class __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc > Const point-type iterator. Definition at line 60 of file left_child_next_sibling_heap_/const_iterator.hpp. Member Typedef Documentation template<typename Node , typename _Alloc > typedef base_type::const_pointer __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::const_pointer Iterator's const pointer type. Definition at line 81 of file left_child_next_sibling_heap_/const_iterator.hpp. template<typename Node , typename _Alloc > typedef base_type::const_reference __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::const_reference Iterator's const reference type. Definition at line 87 of file left_child_next_sibling_heap_/const_iterator.hpp. template<typename Node , typename _Alloc > typedef _Alloc::difference_type __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::difference_type Difference type. Definition at line 72 of file left_child_next_sibling_heap_/const_iterator.hpp. template<typename Node , typename _Alloc > typedef std::forward_iterator_tag __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::iterator_category Category. Definition at line 69 of file left_child_next_sibling_heap_/const_iterator.hpp. template<typename Node , typename _Alloc > typedef base_type::pointer __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::pointer Iterator's pointer type. Definition at line 78 of file left_child_next_sibling_heap_/const_iterator.hpp. template<typename Node , typename _Alloc > typedef base_type::reference __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::reference Iterator's reference type. Definition at line 84 of file left_child_next_sibling_heap_/const_iterator.hpp. template<typename Node , typename _Alloc > typedef base_type::value_type __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::value_type Iterator's value type. Definition at line 75 of file left_child_next_sibling_heap_/const_iterator.hpp. Constructor &; Destructor Documentation template<typename Node , typename _Alloc > __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::left_child_next_sibling_heap_const_iterator_ () [inline] Default constructor. Definition at line 96 of file left_child_next_sibling_heap_/const_iterator.hpp. template<typename Node , typename _Alloc > __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::left_child_next_sibling_heap_const_iterator_ (const left_child_next_sibling_heap_const_iterator_< Node, _Alloc > &other) [inline] Copy constructor. Definition at line 101 of file left_child_next_sibling_heap_/const_iterator.hpp. Member Function Documentation template<typename Node , typename _Alloc > bool __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::operator!= (const left_child_next_sibling_heap_const_iterator_< Node, _Alloc > &other) const [inline] Compares content (negatively) to a different iterator object. Definition at line 111 of file left_child_next_sibling_heap_/const_iterator.hpp. template<typename Node , typename _Alloc > bool __gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc >::operator!= (const left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc > &other) const [inline], [inherited] Compares content (negatively) to a different iterator object. Definition at line 137 of file left_child_next_sibling_heap_/point_const_iterator.hpp. template<typename Node , typename _Alloc > const_reference __gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc >::operator* () const [inline], [inherited] Access. Definition at line 124 of file left_child_next_sibling_heap_/point_const_iterator.hpp. template<typename Node , typename _Alloc > const_pointer __gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc >::operator-> () const [inline], [inherited] Access. Definition at line 116 of file left_child_next_sibling_heap_/point_const_iterator.hpp. template<typename Node , typename _Alloc > bool __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >::operator== (const left_child_next_sibling_heap_const_iterator_< Node, _Alloc > &other) const [inline] Compares content to a different iterator object. Definition at line 106 of file left_child_next_sibling_heap_/const_iterator.hpp. template<typename Node , typename _Alloc > bool __gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc >::operator== (const left_child_next_sibling_heap_node_point_const_iterator_< Node, _Alloc > &other) const [inline], [inherited] Compares content to a different iterator object. Definition at line 132 of file left_child_next_sibling_heap_/point_const_iterator.hpp. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ __gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_< Node, _Alloc >(3cxx)
All times are GMT -4. The time now is 08:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy