Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Listing column names in CSV file Post 302970570 by aberg on Friday 8th of April 2016 06:16:35 AM
Old 04-08-2016
Silly me. That now works.
Thank you very much for your help.
AB
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Listing full file names with the exact length of 3 characters

This is what I have to do: Display the full file name (including the full path) and file size of all files whose name (excluding the path) is exactly 3 characters long. This is the code I have: find / -printf "Name: %f Path: %h Size: %s (bytes)\n" 2>/dev/null | grep -E "Name: .{3,} Path" |... (7 Replies)
Discussion started by: Joesgrrrl
7 Replies

2. Shell Programming and Scripting

Listing file names as soon as they are created

Hi, I have been looking for a method to list file names as soon as they are created. I have used the following command : find . -name "*.xml" -mmin -2 -exec ls --full-time {} \; | sort -k6 this finds all xml files created in the last 2 minutes and orders them by time. The problem is that... (7 Replies)
Discussion started by: phil.e.b
7 Replies

3. 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

4. Shell Programming and Scripting

Pick the column value based on another column from .csv file

My scenario is that I need to pick value from third column based on fourth column value, if fourth column value is 1 then first value of third column.Third column (2|3|4|6|1) values are cancatenated. Main imp point, in my .csv file, third column is having price value with comma (1,20,300), it has... (2 Replies)
Discussion started by: Ganesh L
2 Replies

5. Shell Programming and Scripting

Remove the values from a certain column without deleting the Column name in a .CSV file

(14 Replies)
Discussion started by: dhruuv369
14 Replies

6. Shell Programming and Scripting

Matching the header of a .CSV file with dynamic field names

I have a .CSV file (frequency - weekly) whose header contains the year-week value in two of the columns which keeps changing every week. For an instance please see below. Column1,Column2,Column3,Column4,Column5,Column6,Column7,Column8,Column9,Column10,Column11,Column12,Column13,201420... (4 Replies)
Discussion started by: dhruuv369
4 Replies

7. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

8. Shell Programming and Scripting

Get maximum per column from CSV file, based on date column

Hello everyone, I am using ksh on Solaris 10 and I'm gathering data in a CSV file that looks like this: 20170628-23:25:01,1,0,0,1,1,1,1,55,55,1 20170628-23:30:01,1,0,0,1,1,1,1,56,56,1 20170628-23:35:00,1,0,0,1,1,2,1,57,57,2 20170628-23:40:00,1,0,0,1,1,1,1,58,58,2... (6 Replies)
Discussion started by: ejianu
6 Replies

9. UNIX for Beginners Questions & Answers

Compare every column from one csv file to another csv file

1.csv contains following column- Empid code loc port 101 A xy 01 102 B zx 78 103 A cg 12 104 G xy 78 2.csv contains follwing data- Empid code loc port 101 A gf 01 102 B zx 78 103 C cg 32 104 ... (1 Reply)
Discussion started by: rishabh
1 Replies
Sub::Quote(3pm) 					User Contributed Perl Documentation					   Sub::Quote(3pm)

NAME
Sub::Quote - efficient generation of subroutines via string eval SYNOPSIS
package Silly; use Sub::Quote qw(quote_sub unquote_sub quoted_from_sub); quote_sub 'Silly::kitty', q{ print "meow" }; quote_sub 'Silly::doggy', q{ print "woof" }; my $sound = 0; quote_sub 'Silly::dagron', q{ print ++$sound % 2 ? 'burninate' : 'roar' }, { '$sound' => $sound }; And elsewhere: Silly->kitty; # meow Silly->doggy; # woof Silly->dagron; # burninate Silly->dagron; # roar Silly->dagron; # burninate DESCRIPTION
This package provides performant ways to generate subroutines from strings. SUBROUTINES
quote_sub my $coderef = quote_sub 'Foo::bar', q{ print $x++ . " " }, { '$x' => }; Arguments: ?$name, $code, ?\%captures, ?\%options $name is the subroutine where the coderef will be installed. $code is a string that will be turned into code. "\%captures" is a hashref of variables that will be made available to the code. See the "SYNOPSIS"'s "Silly::dagron" for an example using captures. options o no_install Boolean. Set this option to not install the generated coderef into the passed subroutine name on undefer. unquote_sub my $coderef = unquote_sub $sub; Forcibly replace subroutine with actual code. Note that for performance reasons all quoted subs declared so far will be globally unquoted/parsed in a single eval. This means that if you have a syntax error in one of your quoted subs you may find out when some other sub is unquoted. If $sub is not a quoted sub, this is a no-op. quoted_from_sub my $data = quoted_from_sub $sub; my ($name, $code, $captures, $compiled_sub) = @$data; Returns original arguments to quote_sub, plus the compiled version if this sub has already been unquoted. Note that $sub can be either the original quoted version or the compiled version for convenience. inlinify my $prelude = capture_unroll { '$x' => 1, '$y' => 2, }; my $inlined_code = inlinify q{ my ($x, $y) = @_; print $x + $y . " "; }, '$x, $y', $prelude; Takes a string of code, a string of arguments, a string of code which acts as a "prelude", and a Boolean representing whether or not to localize the arguments. capture_unroll my $prelude = capture_unroll { '$x' => 1, '$y' => 2, }; Generates a snippet of code which is suitable to be used as a prelude for "inlinify". The keys are the names of the variables and the values are (duh) the values. Note that references work as values. CAVEATS
Much of this is just string-based code-generation, and as a result, a few caveats apply. return Calling "return" from a quote_sub'ed sub will not likely do what you intend. Instead of returning from the code you defined in "quote_sub", it will return from the overall function it is composited into. So when you pass in: quote_sub q{ return 1 if $condition; $morecode } It might turn up in the intended context as follows: sub foo { <important code a> do { return 1 if $condition; $morecode }; <important code b> } Which will obviously return from foo, when all you meant to do was return from the code context in quote_sub and proceed with running important code b. perl v5.14.2 2012-06-26 Sub::Quote(3pm)
All times are GMT -4. The time now is 01:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy