Sponsored Content
Top Forums Shell Programming and Scripting Reading variables from CSV file Post 302370554 by rdcwayx on Wednesday 11th of November 2009 08:10:53 PM
Old 11-11-2009
Code:
 awk -F[\"] '{print $2}' file.csv  |while  read var1
do
  echo $var1
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

reading variables from a file

Hi, Could anyone help me in understanding what I am missing.. I have a text file with the following info. INFILE=> #Name Variable=<value> #--------------------------------- name1 inargs="-a Filename1.$VAR.csv -f Filename2.$VAR.csv -c File.c" name1 ... (4 Replies)
Discussion started by: ttshell
4 Replies

2. Shell Programming and Scripting

Script for reading .csv file

Can someone please help me to write script for following scenario : 1> script should read a input .csv file of format : EmpName, PF, Leave, Basic ,HRA 2> another config file ( may be again a .csv file ) has format EmpName and EmpID 3> script should read another config file for each EmpName in... (3 Replies)
Discussion started by: creativeworld
3 Replies

3. Shell Programming and Scripting

reading from a .csv file

Hi , Can anyone please help me to read the value from the .csv file? This is my .csv file: dirnames: first,second i want to get the two names and create directories correspondingly (1 Reply)
Discussion started by: novice_user
1 Replies

4. UNIX for Advanced & Expert Users

Issue reading csv file

HI All I have csv file containing the data like this Electrical Equipment,ElecEquip "Engineering, Machinery & Equipment",Engineerin Entertainment & Broadcasting,Entertain The first and third record are fine,The issue with second records as it has comma enclosed with in inverted... (1 Reply)
Discussion started by: mohdtausifsh
1 Replies

5. Shell Programming and Scripting

Reading variables from a file

Hi, I have an issue that hope someone will be able to help me with.... I'm using a while-read loop to read lines from a file that contain variables, and I want the variables substituted, but I can't get it to work - the below example with explain: while read line do echo $line ... (5 Replies)
Discussion started by: AndyG
5 Replies

6. Shell Programming and Scripting

Reading from a CSV and writing in same CSV file

Hi, I am tryng to read from a csv file and based on some grep command output I will modify one of the column in the same csv. Example:- Input CSV:- 20120829001415,noneAA,google.com 20120829001415,dfsafds,google.com 20120829001415,noneAA,google.com Intermediate Step:- If 2nd column of... (3 Replies)
Discussion started by: kmajumder
3 Replies

7. Shell Programming and Scripting

Reading a csv file using shell script

Hello All, I have a csv file that looks like below ProdId_A,3.3.3,some text,some/text,sometext_1.2.3 ProdId_B,3.3.3,some text,some/text,sometext_1.2.3 ProdId_C,3.3.3,some text,some/text,sometext_1.2.3 ProdId_A,6.6.6,some text,some/text,sometext_9.9.9 I will get ProdId from... (5 Replies)
Discussion started by: anand.shah
5 Replies

8. Shell Programming and Scripting

Reading last line of a CSV file

Hi I have a file which I am reading line by line and processing it. But the last line is not getting read in the file loop until I put an enter in the end. #!/bin/ksh -p v_org_id=${P1} FILE=${P2} NEW_FILE_NAME=$APPLPTMP/b1.txt BAKIFS=$IFS IFS=$'\n' exec 0<"$FILE" echo "File to be... (2 Replies)
Discussion started by: Chinky23
2 Replies

9. Shell Programming and Scripting

Reading the value of particular column from csv file

Hi Folks, I have the below csv file which is comma delimited , now from this file i need to read the value of the column der_id and then want to create a separate text file which will contain the value of the column der_id only please advise how to read the value of the column der_id and then... (3 Replies)
Discussion started by: punpun66
3 Replies

10. Shell Programming and Scripting

Reading CSV file

Hi experts, Im having csv file with few columns which should contain data as shown below. Want to check if column 3 contain row with duplicate value(9876,9876) then corresponding to this in col2 should contain text "tax" and should not contain text "non". Word "non" can come but if in column3... (2 Replies)
Discussion started by: as7951
2 Replies
VAR_EXPORT(3)								 1							     VAR_EXPORT(3)

var_export - Outputs or returns a parsable string representation of a variable

SYNOPSIS
mixed var_export (mixed $expression, [bool $return = false]) DESCRIPTION
var_export(3) gets structured information about the given variable. It is similar to var_dump(3) with one exception: the returned represen- tation is valid PHP code. PARAMETERS
o $expression - The variable you want to export. o $return - If used and set to TRUE, var_export(3) will return the variable representation instead of outputting it. RETURN VALUES
Returns the variable representation when the $return parameter is used and evaluates to TRUE. Otherwise, this function will return NULL. NOTES
Note When the $return parameter is used, this function uses internal output buffering so it cannot be used inside an ob_start(3) callback function. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.1.0 | | | | | | | Possibility to export classes and arrays con- | | | taining classes using the __set_state() magic | | | method. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 var_export(3) Examples <?php $a = array (1, 2, array ("a", "b", "c")); var_export($a); ?> The above example will output: array ( 0 => 1, 1 => 2, 2 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ), ) <?php $b = 3.1; $v = var_export($b, true); echo $v; ?> The above example will output: 3.1 Example #2 Exporting classes since PHP 5.1.0 <?php class A { public $var; } $a = new A; $a->var = 5; var_export($a); ?> The above example will output: A::__set_state(array( 'var' => 5, )) Example #3 Using __set_state() (since PHP 5.1.0) <?php class A { public $var1; public $var2; public static function __set_state($an_array) { $obj = new A; $obj->var1 = $an_array['var1']; $obj->var2 = $an_array['var2']; return $obj; } } $a = new A; $a->var1 = 5; $a->var2 = 'foo'; eval('$b = ' . var_export($a, true) . ';'); // $b = A::__set_state(array( // 'var1' => 5, // 'var2' => 'foo', // )); var_dump($b); ?> The above example will output: object(A)#2 (2) { ["var1"]=> int(5) ["var2"]=> string(3) "foo" } NOTES
Note Variables of type resource couldn't be exported by this function. Note var_export(3) does not handle circular references as it would be close to impossible to generate parsable PHP code for that. If you want to do something with the full representation of an array or object, use serialize(3). Warning When var_export(3) exports objects, the leading backslash is not included in the class name of namespaced classes for maximum com- patibility. SEE ALSO
print_r(3), serialize(3), var_dump(3). PHP Documentation Group VAR_EXPORT(3)
All times are GMT -4. The time now is 01:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy