Sponsored Content
Top Forums Shell Programming and Scripting need help in correcting the code Post 302556356 by me_newbie on Sunday 18th of September 2011 06:54:57 AM
Old 09-18-2011
Hi

your code is working fine but can you explain a bit only this part >>>> sed 's/ *\(.*\) \(.*\)/\2 \1/'


and if you don't mind please explain also

what is difference between these two lines why they give difference results?

Code:
[ cut -f1 -d' ' file_name | sort |uniq -c | sort -nr ]

"what the first sort does in the above line"?

Code:
[ cut -f1 -d' ' file_name | uniq -c | sort -nr ]

"the second line produce different result "

BR

Eva

Last edited by Scott; 09-18-2011 at 10:28 AM.. Reason: ...
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Correcting script

Hi! I have for example a script/file: +1 echo "toto" +2 echo "abcdef +3 echo "dqmsl" $r "dsqlfj" +4 cat titi | tr \t' ';' +5 exit --------------------------------------- I try to find a solution who say: <ERROR> The character " has been forgotten a the line 2 The character... (7 Replies)
Discussion started by: Castelior
7 Replies

2. Solaris

Correcting system time

I've installed Solaris 8, but didn't quite give it the correct (machine) time. Think the machine is out of sync. Can I change that afterwards or do I have to do another install right from the beginning? (1 Reply)
Discussion started by: kuultak
1 Replies

3. UNIX for Dummies Questions & Answers

Correcting the time on FreeBSD

Possibly this is not even a FreeBSD issue, but a BIOS issue. Upon installation of FreeBSD, the time is set using the standard feature of selecting a time zone. Some installations are correctly set to the current time, but others are either one or two hours off. So the time is read from the time... (0 Replies)
Discussion started by: figaro
0 Replies

4. AIX

Help me in correcting sendmail.cf

Hi all, In AIX I need to set the below two as of now these are not. 1)Opnoexpn is not set in sendmail.cf 2)Opnovrfy is not set in sendmail.cf Please let me know the steps to set Opnoexpn and Opnovrfy in sendmail.cf Thanks and Regards, Pavankumar (0 Replies)
Discussion started by: pavankumar432
0 Replies

5. UNIX Desktop Questions & Answers

Correcting the display resolution

I have an issue with the display resolution under Xfce. The monitor can handle 1024x768, but the screen display is 800x600. The control panel does not allow me to change this. I also found the file .config/xfce4/xfconf/xfce-perchannel-xml/displays.xml in which I have made changes, but after a... (0 Replies)
Discussion started by: figaro
0 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Help correcting file with differing number of fields

Hi all, I have a tab separated file, and one of the fields is sub-delimited by colon. The problem is there can be zero to 4 colons within this field. When I try to change colons to tabs the result is a file with a differing number of fields. I want to go from: a:b:c:d:e a:b:c a:b:c:d:e a... (4 Replies)
Discussion started by: torchij
4 Replies

7. Shell Programming and Scripting

Need help in correcting sed script

Hi All, I have a big configuration log where I want to change string "aaa" to "bbb" under auto-config-policy only right after "deny", "accept" and "hold" strings, nowhere else. <<<< text >>>>> auto-config-policy test deny aaa precedence 4 profile aaa any deny aaa... (4 Replies)
Discussion started by: temp.sha
4 Replies

8. Shell Programming and Scripting

Correcting awk error

the following code turns back ticks "`" to new lines "\n". Then, it attempts to grab only a certain section of the output and excludes lines that contain particular patterns...i.e. "ZooLine|echo|opencert". awk -vs1="\`" '{gsub(s1,"\n",$0)} 1 {print ; if(/NewLine \(\)/,/}/{if(!/NewLine|echo... (3 Replies)
Discussion started by: SkySmart
3 Replies
UNIQ(1) 							   User Commands							   UNIQ(1)

NAME
uniq - report or omit repeated lines SYNOPSIS
uniq [OPTION]... [INPUT [OUTPUT]] DESCRIPTION
Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output). With no options, matching lines are merged to the first occurrence. Mandatory arguments to long options are mandatory for short options too. -c, --count prefix lines by the number of occurrences -d, --repeated only print duplicate lines, one for each group -D, --all-repeated[=METHOD] print all duplicate lines groups can be delimited with an empty line METHOD={none(default),prepend,separate} -f, --skip-fields=N avoid comparing the first N fields --group[=METHOD] show all items, separating groups with an empty line METHOD={separate(default),prepend,append,both} -i, --ignore-case ignore differences in case when comparing -s, --skip-chars=N avoid comparing the first N characters -u, --unique only print unique lines -z, --zero-terminated end lines with 0 byte, not newline -w, --check-chars=N compare no more than N characters in lines --help display this help and exit --version output version information and exit A field is a run of blanks (usually spaces and/or TABs), then non-blank characters. Fields are skipped before chars. Note: 'uniq' does not detect repeated lines unless they are adjacent. You may want to sort the input first, or use 'sort -u' without 'uniq'. Also, comparisons honor the rules specified by 'LC_COLLATE'. GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report uniq translation bugs to <http://translationproject.org/team/> AUTHOR
Written by Richard M. Stallman and David MacKenzie. COPYRIGHT
Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
comm(1), join(1), sort(1) The full documentation for uniq is maintained as a Texinfo manual. If the info and uniq programs are properly installed at your site, the command info coreutils 'uniq invocation' should give you access to the complete manual. GNU coreutils 8.22 June 2014 UNIQ(1)
All times are GMT -4. The time now is 11:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy