Sponsored Content
Top Forums Shell Programming and Scripting Help in assigning values to variables from the file Post 302530083 by abk07 on Sunday 12th of June 2011 11:32:01 PM
Old 06-13-2011
Quote:
Originally Posted by Ygor
Try...
Code:
n1=$(head -1 file1)
n2=$(tail -1 file1)

Thank you Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem in assigning values to variables

Hi, I have some problem in assigning values to variables: This is what Iam literally doing: i=0 input=test temp$i = $input In the sense, I try to assign the value in the variable input (ie., test) to another variable temp0 (since i is assigned 0, temp$i is temp0). Seems simple, but I get... (3 Replies)
Discussion started by: mohanprabu
3 Replies

2. Shell Programming and Scripting

Assigning file attributes to variables

Hi, I'm trying to assign the permissions, owner and group of a file to seperate variables, but using ls -l filename | awk '{print $1 "\t" $3 "\t" $4}' gives the owner as tom.ja instead of tom.james Is there any way to expand it so i get the full name, or is there an easier way to get them... (5 Replies)
Discussion started by: olimiles
5 Replies

3. UNIX for Dummies Questions & Answers

Reading from a file and assigning values

HI I have something like this in a file ABC = 1 DEF = 2 GHI = 3 JKL = 4 MNO = 5 QRS = 6 TUV = 7 I need to assign ABC to V_abc (that is to a variable) GHI to V_ghi (that is to another variable) TUV to say V_tuv ... (6 Replies)
Discussion started by: ssuresh1999
6 Replies

4. Shell Programming and Scripting

Assigning values to reference variables for a dynamic menu driven script.

How do I assign values to reference variables? I am assigning a variable name to --> $user_var Then I am trying to change its underlying variable value by $((user_var))=$user_value .. its failing,, Please let me know if there is a way to do this dynamically.. FileA.props... (5 Replies)
Discussion started by: kchinnam
5 Replies

5. Shell Programming and Scripting

Perl Help - Assigning variables to text file contents

I am looking to create a perl script which will take numbers from a simple text file, convert them from decimal to hex, and then rewrite those values in the file or create a new file with the hex numbers(whichever's easier). My text document for example would be something as simple as 1312... (6 Replies)
Discussion started by: samh785
6 Replies

6. Shell Programming and Scripting

Assigning fields values to different variables

Hi, I have this code: cat file.txt | awk -F, 'NR==1{print $6","$8","$10","$20","$21","$19}' > file.tmp VAR1=`cat file.tmp | cut -d "," -f1` VAR2=`cat file.tmp | cut -d "," -f2` VAR3=`cat file.tmp | cut -d "," -f3`; VAR4=`cat file.tmp | cut -d "," -f4`; VAR5=`cat... (1 Reply)
Discussion started by: Tr0cken
1 Replies

7. Shell Programming and Scripting

Bash: Reading a file and assigning variables from file

I have a file that has four values on each line and I'd like to give each column a variable name and then use those values in each step of a loop. In bash, I believe you could use a while loop to do this or possibly a cat command, but I am super new to programming and I'm having trouble decoding... (2 Replies)
Discussion started by: ccorder22
2 Replies

8. Shell Programming and Scripting

Assigning values to 2 variables within for loop

Hi All, Is it possible to grep for two files and assign their names to two separate variables with for loop? I am doing the below currently: if then for fname in $( cd $dirA ; ls -tr | grep "^Ucountry_file$") do InFile=$dirA/$fname ... (4 Replies)
Discussion started by: swasid
4 Replies

9. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

10. Shell Programming and Scripting

Searching a file - and assigning responses to variables (or something)

So first: Sorry if the title is confusing... I have a script I'm writing with a file with several names in it (some other info - but it's not really pertinent...) - I want to be allow the user to delete certain records, but I ran into a problem I'm not sure how to go about fixing. If I were... (6 Replies)
Discussion started by: sabster
6 Replies
DEVSCRIPTS.CONF(5)						File Formats Manual						DEVSCRIPTS.CONF(5)

NAME
       devscripts.conf - configuration file for the devscripts package

DESCRIPTION
       The  devscripts	package provides a collection of scripts which may be of use to Debian developers and others wishing to build Debian pack-
       ages.  Many of these have options which can be configured on a system-wide and per-user basis.

       Every script in the devscripts package which makes use of values from these configuration files describes the specific settings	recognised
       in its own manpage.  (For a list of the scripts, either see /usr/share/doc/devscripts/README.gz or look at the output of dpkg -L devscripts
       | grep /usr/bin.)

       The two configuration files are /etc/devscripts.conf for system-wide defaults and ~/.devscripts for per-user settings.	They  are  written
       with  bash(1)  syntax, but should only have comments and simple variable assignments in them; they are both sourced (if present) by many of
       the devscripts scripts.	Variables corresponding to simple switches should have one of the values yes and no; any other setting is regarded
       as equivalent to the default setting.

       All  variable  names  are  written  in  uppercase, and begin with the script name.  Package-wide variables begin with "DEVSCRIPTS", and are
       listed below, as well as in the relevant manpages.

       For a list of  all  of  the  available  options	variables,  along  with  their	default  settings,  see  the  example  configuration  file
       /usr/share/doc/devscripts/devscripts.conf.ex.   This  is  copied  to  /etc/devscripts.conf  when the devscripts package is first installed.
       Information about configuration options introduced in newer versions of the package will be appended to /etc/devscripts.conf when the pack-
       age is upgraded.

       Every script which reads the configuration files can be forced to ignore them by using --no-conf as the first command-line option.

PACKAGE-WIDE VARIABLES
       The currently recognised package-wide variables are:

       DEVSCRIPTS_CHECK_DIRNAME_LEVEL, DEVSCRIPTS_CHECK_DIRNAME_REGEX
	      These  variables	control  scripts  which change directory to find a debian/changelog file or suchlike, and some other miscellaneous
	      cases.  In order to prevent unwanted, even possibly dangerous, behaviour, these variables control when actions  will  be	performed.
	      The scripts which currently make use of these variables are: debc, debchange/dch, debclean, debi, debrelease, debuild and uscan, but
	      this list may change with time (and I may not remember to update this manpage).  Please see the manpages of individual  scripts  for
	      details of the specific behaviour for each script.

SEE ALSO
       devscripts(1) and /usr/share/doc/devscripts/README.gz.

AUTHOR
       This manpage was written for the devscripts package by the package maintainer Julian Gilbey <jdg@debian.org>.

DEBIAN								 Debian Utilities						DEVSCRIPTS.CONF(5)
All times are GMT -4. The time now is 03:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy