Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Greeny boy needs your help. script "sort" Post 303028403 by fohatadri on Monday 7th of January 2019 09:08:55 AM
Old 01-07-2019
Greeny boy needs your help. script "sort"

Hello!

I have an issue with sorting or pasting. Do not know what the problem is, been trying to fix it for days. I think I'm stupid.
My home task sounds like this: create 100 files with 1 random number ranging from 1 to 1000.
Then paste all numbers from those 100 files to 1 complete file and sort it from smallest to highest.
This is my script:
Code:
#!/bin/bash
rm -rf DATA
mkdir DATA
for x in {1..100}
do
touch DATA/$x.txt
shuf -i 1-1000 -n 1 > DATA/$x.txt
done
paste DATA/*.txt > DATA/ALL.txt
sort -g DATA/ALL.txt > DATA/ALL_sorted.txt

Problem is that all the data in ALL.txt is not in one column but in many and file ALL_sorted.txt is the same. Nothing sorts nothing.
HELP! I think the issue is in pasting but dunno.

Last edited by Neo; 01-07-2019 at 10:10 AM.. Reason: Added Code Tags. Please read the rules. They are important.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

Meaning of "b" modifier in "sort" command

I need to sort the following file by the rhdiskpower devices in the last column: Total_MB Free_MB OS_MB Name Failgroup Library Label UDID Product Redund Path 1024 851 1024 OCRVOT1_0000 OCRVOT1_0000 System UNKNOWN ... (3 Replies)
Discussion started by: wjssj
3 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

Is it Possible to sort a list of hexadecimal numbers using "sort" command?

Hello Everybody :) !!!. i have question in mind, is it possible to sort a list of hexadecimal numbers using "sort" command? (9 Replies)
Discussion started by: Kesavan
9 Replies

5. UNIX for Dummies Questions & Answers

"Help with bash script" - "License Server and Patch Updates"

Hi All, I'm completely new to bash scripting and still learning my way through albeit vey slowly. I need to know where to insert my server names', my ip address numbers through out the script alas to no avail. I'm also searching on how to save .sh (bash shell) script properly.... (25 Replies)
Discussion started by: profileuser
25 Replies

6. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

7. UNIX for Beginners Questions & Answers

Extract delta records using with "comm" and "sort" commands combination

Hi All, I have 2 pipe delimited files viz., file_old and file_new. I'm trying to compare these 2 files, and extract all the different rows between them into a new_file. comm -3 < sort file_old < sort file_new > new_file I am getting the below error: -ksh: sort: cannot open But if I do... (7 Replies)
Discussion started by: njny
7 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
oggz-sort(1)						      General Commands Manual						      oggz-sort(1)

NAME
oggz-sort -- Sort the pages of an Ogg file in order of presentation time. SYNOPSIS
oggz-sort [-o filename | --output filename ] filename oggz-sort [-h | --help ] [-v | --version ] Description oggz-sort sorts an Ogg file, interleaving pages in order of presentation time. It correctly interprets the granulepos timestamps of Ogg CELT, CMML, Dirac, FLAC, Kate, PCM, Speex, Theora and Vorbis bitstreams. Run oggz-known-codecs(1) for a full list of codecs known by the installed version of oggz. Some encoders produce files with incorrect page ordering; for example, some audio and video pages may occur out of order. Although these files are usually playable, it can be difficult to accurately seek or scrub on them, increasing the likelihood of glitches during playback. Players may also need to use more memory in order to buffer the audio and video data for synchronized playback, which can be a problem when the files are viewed on low-memory devices. Some older Ogg encoders also produce pages which incorrectly have granulepos timestamps recorded that shouldn't be: pages which have no completed packets must have a granulepos of -1. oggz-sort will correct such granulepos during the process of sorting. The tool oggz-validate can be used to check the relative ordering of packets in a file, and also to detect incorrect granulepos on pages with no completed packets. If either of these errors are reported, or use oggz-sort to fix the problem. Options oggz-sort accepts the following options: Miscellaneous options -o filename, --output filename Write output to the specified filename instead of printing it to standard output. -h, --help Display usage information and exit. -v, --version Output version information and exit. EXAMPLES
Correct the page ordering in broken.ogv: oggz sort -o fixed.ogv broken.ogv AUTHOR
Conrad Parker January 25, 2008; COPYRIGHT
Copyright (C) 2008 Annodex Association SEE ALSO
oggz-validate(1), oggz-merge(1), oggz-dump(1), oggz-diff(1), hogg(1) oggz-sort(1)
All times are GMT -4. The time now is 02:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy