Sponsored Content
Top Forums Shell Programming and Scripting Converting to columnar output Post 302222828 by joeyg on Thursday 7th of August 2008 02:50:45 PM
Old 08-07-2008
Question Can you provide an example of input/output?

If this is the input...
(think of nesting as in the directory structure)
Code:
animals
  humans
    Joe
    John
    Mary
  dogs
  cats
fruits
  apples
    red
    granny
  banana

then output =
????
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

converting kb to mb

When I create filesystems in AIX i often get confused(using smit) When you specify size in aix, it is asked like this SIZE of file system (in 512-byte blocks) I never seem to grasp this, what is the equation to get say 500mb? Or is there a program anyone knows of that does this, like a... (1 Reply)
Discussion started by: csaunders
1 Replies

2. UNIX for Dummies Questions & Answers

Converting gettimeoftheday output to string

Hi .. is there a way i can retrieve the output of gettimeoftheday in a string (1 Reply)
Discussion started by: p_aishwarya
1 Replies

3. Shell Programming and Scripting

Converting line output to column based output

Hi Guys, I am trying to convert a file which has a row based output to a column based output. My original file looks like this: 1 2 3 4 5 6 1 2 3 1 2 3 (8 Replies)
Discussion started by: npatwardhan
8 Replies

4. Shell Programming and Scripting

File Comparison Columnar?

I'm looking to build up a process which would compare 2 files and show difference, the difference needs to be done in such a way that it also shows which column value is differing. So i think of this. Run a diff between the files , then someway find which columns have different values need to... (6 Replies)
Discussion started by: dinjo_jo
6 Replies

5. Shell Programming and Scripting

Need help converting df output to gigabytes

I need some help converting the disk space values in kilobytes to gigabytes. I can't use df -h because the report has to be in megabytes for some disk space tracking software the customer is using. I have been playing around with trying to assign variables I can use outside of awk so I can do... (1 Reply)
Discussion started by: kuliksco
1 Replies

6. Ubuntu

Converting Impress output to DVD video

I have a need to convert 'Impress' presentations to DVD video format whilst retaining the original presentation in situ. Copying the individual slides and modifying size etc. in Gimp and then importing them into 'Openshot' is both long winded and the loss of quality is significant. Can anybody... (14 Replies)
Discussion started by: Royalist
14 Replies

7. UNIX for Dummies Questions & Answers

Converting txt output to rows and columns and send report via mail.

Hi All, I would like to send below output in a tabular column ( xml or excel ) and send a mail. vinay unix anil sql vamsee java request to suggest a solution. (1 Reply)
Discussion started by: Girish19
1 Replies

8. Shell Programming and Scripting

Need Help in converting

I have Excel file with the below three columns, i need your expertise in converting this to .csv file delimiter "|" Excel - Serial Number Serial Name Serial Brand 111 test sample 123 test2 sample1 134 ... (9 Replies)
Discussion started by: kiran_hp
9 Replies

9. Shell Programming and Scripting

Linear Interpolation of CSV Columnar Data

I am trying to perform linear interpolation on three columns in a CSV file. When I run this code, I do not get any changes in the output (see Expected Output). What am I doing wrong here? Awk Code ' function interpolate(lat1, lon1, t1, lat2, lon2, t2, i) { for (i = 1; i... (2 Replies)
Discussion started by: hrrruser
2 Replies

10. Programming

Joining Columnar heading from 2 lines

Hi, Below is the format of a report generated by a custom reporting solution. I opened the report in Notepad++ and junked data and values as in the image below. https://www.unix.com/attachment.php?attachmentid=7907&stc=1&d=1575507708 I want to convert the values to a PIPE delimited format as... (2 Replies)
Discussion started by: ramkrix
2 Replies
UKSORT(3)								 1								 UKSORT(3)

uksort - Sort an array by keys using a user-defined comparison function

SYNOPSIS
bool uksort (array &$array, callable $key_compare_func) DESCRIPTION
uksort(3) will sort the keys of an array using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function. PARAMETERS
o $array - The input array. o $key_compare_func - The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. int callback (mixed $a, mixed $b) RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 uksort(3) example <?php function cmp($a, $b) { $a = preg_replace('@^(a|an|the) @', '', $a); $b = preg_replace('@^(a|an|the) @', '', $b); return strcasecmp($a, $b); } $a = array("John" => 1, "the Earth" => 2, "an apple" => 3, "a banana" => 4); uksort($a, "cmp"); foreach ($a as $key => $value) { echo "$key: $value "; } ?> The above example will output: an apple: 3 a banana: 4 the Earth: 2 John: 1 SEE ALSO
usort(3), The comparison of array sorting functions. PHP Documentation Group UKSORT(3)
All times are GMT -4. The time now is 08:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy