Sponsored Content
Full Discussion: 2 problems... sed and sort
Top Forums Shell Programming and Scripting 2 problems... sed and sort Post 302401902 by Castelior on Monday 8th of March 2010 08:34:06 AM
Old 03-08-2010
2 problems... sed and sort

Hi everyone!

I have a file like that:
Quote:
Jan:17:R00071
Jan:24:R00024
Jan:22:R00073
Jan:14:R00061
Jan:10:R00034
Feb:3:R00033
Feb:9:R00075
Feb:8:R00056
Feb:4:R00010
Feb:2:R00055
Feb:25:R00077
And I would it like that:
Quote:
Jan:10:R00034
Jan:14:R00061
Jan:17:R00071
Jan:22:R00073
Jan:24:R00024
Feb:2:R00055
Feb:3:R00033
Feb:4:R00010
Feb:8:R00056
Feb:9:R00075
Feb:25:R00077
I don't know how to keep the first field and sort the second one.



I have a second question with sed...
Quote:
VAR="toto"
cat file.txt| sed 's/^/$VAR:/g'
to put the variable $VAR at the beginning of the file...
But I have an output like this:

Quote:
$VAR:xxxx
$VAR:yyyy
$VAR:yyxxx
snork Smilie

I'm confused...

Thanks a lot for your answers
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problems with sed

Hi, I'm trying to use the sed command but I'm not sure how to use it properly. I've read the man pages for the sed command but I'm still unsure on how to use it. Basically I have a file with the words male and female written multiple times. I want to swap the word male for female and... (4 Replies)
Discussion started by: tugade
4 Replies

2. Shell Programming and Scripting

Problems with SED

I have a group of xml files and I need to insert 3 parameters just after this line in each file: ---------------Pattern to be searched for------------------------- <!--The following configuration is a test configuration--> ---------------Parameters to be added---------------------------... (11 Replies)
Discussion started by: collern2
11 Replies

3. Shell Programming and Scripting

how to use sed to sort out this question

root:x:0:0:0000-Admin(0000):/:/sbin/sh rootcsh:x:0:1:0000-Admin(0000):/:/bin/csh nocol:x:6312:630:NOCOL Monitor,,,:/usr/local/lib/nocol-client:/usr/local/bin/bash nobody:x:60001:60001:uid no body:/:/usr/local/bin/bash noaccess:x:60002:60002:uid no access:/:/usr/local/bin/bash... (2 Replies)
Discussion started by: sonicstage
2 Replies

4. Shell Programming and Scripting

problems using sed

i have a file acc.sh which has about 10 lines and then i have defined $var which has a line number in it (say 5). i want to extarct from line 5 to the end of the file and put the output into another file. I have used sed -n $var,'$p' acc.sh | tee abc.sh but at times it does'nt work and gives an... (6 Replies)
Discussion started by: lassimanji
6 Replies

5. Shell Programming and Scripting

Sed with sort doesnt work

Sed with sort doesnt work The below code doesnt work: sed -e '/^$/d' -e 's/,/|/g' | sort -t"|" -k1,1 -u file1 when i seperate them it work but i have to create intermediate file which i dont want to: sed -e '/^$/d' -e 's/,/|/g' file1 > file2 sort -t"|" -k1,1 -u file2 Help... (2 Replies)
Discussion started by: pinnacle
2 Replies

6. Shell Programming and Scripting

Help, awk sed sort

Hi,everyone: I'm new to shell, and now get trouble with some script: line=`/usr/xpg4/bin/awk '/^(*\|){2}'"$CR"'/ {print $0}' ${TIER4FILE}|grep -v OSNAME=`sed -n ''$LINE'p' $DATALOC/os` sort +1 /tmp/LhasaCRs2 > /tmp/LhasaCRs1 I cannot understand the "{2}" here. My mentor said it... (1 Reply)
Discussion started by: mycoy
1 Replies

7. UNIX for Advanced & Expert Users

problems with sed

$ echo "a,0,0,0,b,0" | sed 's/,0,/,1,/g' gives output as $ a,1,0,1,b,0 rather than as a,1,1,1,b,0 how can i solve this problem Thanks a lot in advance.... Use code tags. (4 Replies)
Discussion started by: manishma71
4 Replies

8. Shell Programming and Scripting

Sort with Awk, sed ....

I want to print out the lines that have the max value in column 3. and count the occurrence of column 1; if there are more than one occurrences, line with highest column 2 value will be printed. I have this data: input: AV 234 25 AV 256 76 AS 421 34 AV 124 76 BD 136 71 BD 241 76 AW... (10 Replies)
Discussion started by: aydj
10 Replies

9. Shell Programming and Scripting

sed --> sort data by date

Hi, i "tried" to sort data by date. So far, i used sed to take the data from the last and the actual month. Now, after changing the year it is not working properly. i use: GNU bash, version 4.2.45(1)-release (x86_64-suse-linux-gnu) sed -n '/\//p' $Home/../scripte/pd_0.txt y is a... (6 Replies)
Discussion started by: IMPe
6 Replies

10. HP-UX

sed help with underscore problems

Hello, I have spent a couple of hours trying to answer this myself, so forgive me if the answer is simple but I have tried. I have a text file generated from svn log output which contains a list of files. Two regexps im using are * and * They both work but some lines has a mixture... (7 Replies)
Discussion started by: YogaBija
7 Replies
DateTime::Locale::xh(3) 				User Contributed Perl Documentation				   DateTime::Locale::xh(3)

NAME
DateTime::Locale::xh SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'xh' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Xhosa. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) Mvulo Lwesibini Lwesithathu Lwesine Lwesihlanu Mgqibelo Cawe Abbreviated (format) Mvu Bin Tha Sin Hla Mgq Caw Narrow (format) Mvu Bin Tha Sin Hla Mgq Caw Wide (stand-alone) Mvulo Lwesibini Lwesithathu Lwesine Lwesihlanu Mgqibelo Cawe Abbreviated (stand-alone) Mvu Bin Tha Sin Hla Mgq Caw Narrow (stand-alone) 2 3 4 5 6 7 1 Months Wide (format) Janyuwari Februwari Matshi Epreli Meyi Juni Julayi Agasti Septemba Okthoba Novemba Disemba Abbreviated (format) Jan Feb Mat Epr Mey Jun Jul Aga Sep Okt Nov Dis Narrow (format) Jan Feb Mat Epr Mey Jun Jul Aga Sep Okt Nov Dis Wide (stand-alone) Janyuwari Februwari Matshi Epreli Meyi Juni Julayi Agasti Septemba Okthoba Novemba Disemba Abbreviated (stand-alone) Jan Feb Mat Epr Mey Jun Jul Aga Sep Okt Nov Dis Narrow (stand-alone) 1 2 3 4 5 6 7 8 9 10 11 12 Quarters Wide (format) 1 unyangantathu 2 unyangantathu 3 unyangantathu 4 unyangantathu Abbreviated (format) Q1 Q2 Q3 Q4 Narrow (format) 1 2 3 4 Wide (stand-alone) 1 unyangantathu 2 unyangantathu 3 unyangantathu 4 unyangantathu Abbreviated (stand-alone) Q1 Q2 Q3 Q4 Narrow (stand-alone) 1 2 3 4 Eras Wide BC umnyaka wokuzalwa kukaYesu Abbreviated BC AD Narrow BC AD Date Formats Full 2008-02-05T18:30:30 = Lwesibini, 2008 Februwari 05 1995-12-22T09:05:02 = Lwesihlanu, 1995 Disemba 22 -0010-09-15T04:44:23 = Mgqibelo, -10 Septemba 15 Long 2008-02-05T18:30:30 = 2008 Februwari 5 1995-12-22T09:05:02 = 1995 Disemba 22 -0010-09-15T04:44:23 = -10 Septemba 15 Medium 2008-02-05T18:30:30 = 2008 Feb 5 1995-12-22T09:05:02 = 1995 Dis 22 -0010-09-15T04:44:23 = -10 Sep 15 Short 2008-02-05T18:30:30 = 2008-02-05 1995-12-22T09:05:02 = 1995-12-22 -0010-09-15T04:44:23 = -010-09-15 Default 2008-02-05T18:30:30 = 2008 Feb 5 1995-12-22T09:05:02 = 1995 Dis 22 -0010-09-15T04:44:23 = -10 Sep 15 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = Lwesibini, 2008 Februwari 05 18:30:30 UTC 1995-12-22T09:05:02 = Lwesihlanu, 1995 Disemba 22 09:05:02 UTC -0010-09-15T04:44:23 = Mgqibelo, -10 Septemba 15 04:44:23 UTC Long 2008-02-05T18:30:30 = 2008 Februwari 5 18:30:30 UTC 1995-12-22T09:05:02 = 1995 Disemba 22 09:05:02 UTC -0010-09-15T04:44:23 = -10 Septemba 15 04:44:23 UTC Medium 2008-02-05T18:30:30 = 2008 Feb 5 18:30:30 1995-12-22T09:05:02 = 1995 Dis 22 09:05:02 -0010-09-15T04:44:23 = -10 Sep 15 04:44:23 Short 2008-02-05T18:30:30 = 2008-02-05 18:30 1995-12-22T09:05:02 = 1995-12-22 09:05 -0010-09-15T04:44:23 = -010-09-15 04:44 Default 2008-02-05T18:30:30 = 2008 Feb 5 18:30:30 1995-12-22T09:05:02 = 1995 Dis 22 09:05:02 -0010-09-15T04:44:23 = -10 Sep 15 04:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 Bin 1995-12-22T09:05:02 = 22 Hla -0010-09-15T04:44:23 = 15 Mgq Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 PM 1995-12-22T09:05:02 = 9:05 AM -0010-09-15T04:44:23 = 4:44 AM Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (M-d) 2008-02-05T18:30:30 = 2-5 1995-12-22T09:05:02 = 12-22 -0010-09-15T04:44:23 = 9-15 MEd (E, M-d) 2008-02-05T18:30:30 = Bin, 2-5 1995-12-22T09:05:02 = Hla, 12-22 -0010-09-15T04:44:23 = Mgq, 9-15 MMM (LLL) 2008-02-05T18:30:30 = Feb 1995-12-22T09:05:02 = Dis -0010-09-15T04:44:23 = Sep MMMd (MMM d) 2008-02-05T18:30:30 = Feb 5 1995-12-22T09:05:02 = Dis 22 -0010-09-15T04:44:23 = Sep 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = Bin Feb 5 1995-12-22T09:05:02 = Hla Dis 22 -0010-09-15T04:44:23 = Mgq Sep 15 MMMMd (MMMM d) 2008-02-05T18:30:30 = Februwari 5 1995-12-22T09:05:02 = Disemba 22 -0010-09-15T04:44:23 = Septemba 15 MMMMEd (E MMMM d) 2008-02-05T18:30:30 = Bin Februwari 5 1995-12-22T09:05:02 = Hla Disemba 22 -0010-09-15T04:44:23 = Mgq Septemba 15 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (y-M) 2008-02-05T18:30:30 = 2008-2 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -10-9 yMEd (EEE, y-M-d) 2008-02-05T18:30:30 = Bin, 2008-2-5 1995-12-22T09:05:02 = Hla, 1995-12-22 -0010-09-15T04:44:23 = Mgq, -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 Feb 1995-12-22T09:05:02 = 1995 Dis -0010-09-15T04:44:23 = -10 Sep yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = Bin, 2008 Feb 5 1995-12-22T09:05:02 = Hla, 1995 Dis 22 -0010-09-15T04:44:23 = Mgq, -10 Sep 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 Februwari 1995-12-22T09:05:02 = 1995 Disemba -0010-09-15T04:44:23 = -10 Septemba yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 Q1 1995-12-22T09:05:02 = 1995 Q4 -0010-09-15T04:44:23 = -10 Q3 Miscellaneous Prefers 24 hour time? Yes Local first day of the week Mvulo SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::xh(3)
All times are GMT -4. The time now is 04:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy