Sponsored Content
Full Discussion: sed beginner question
Top Forums Shell Programming and Scripting sed beginner question Post 302493765 by jurgen on Thursday 3rd of February 2011 04:35:21 PM
Old 02-03-2011
sed beginner question

hi and sorry for crossposting...
I have data, the first column is the date ("2011 02 03 12 45") and follow I have the measurements . What I would like to do is:
to read the data line by line and write the data of "today" in a new file and "yesterday" as well in another file, separated by TAB,- and the date should be in the form of "2011/02/03 12:45:00".(today and yesterday is already defined in another script)....
Example of an input file and how the files should be divided into 2 outputfiles:
Code:
input file:Filename: 111

2011 02 03 17 00 220 11.3    6.4   9     993.3   5.4     
2011 02 03 16 00 250 11.8    6.4   9     994.6   7.7    
2011 02 02 20 00 240 10.8    4.0   7     994.5   9.4      
2011 02 02 19 00 240 12.4    4.2   7     994.6   9.1      
2011 02 02 18 00 240 11.8    3.8   7     994.4   9.9      

output:Filename:111_20110203

2011/02/03 17:00:00    220    11.3    6.4    9    993.3    5.4     
2011/02/03 16:00:00    250    11.8    6.4    9    994.6    7.7     


ouput2:filename:111_20110202
2011/02/02 20:00:00    240    10.8    4.0    7    994.5    9.4       
2011/02/02 19:00:00    240    12.4    4.2    7    994.6    9.1         
2011/02/02 18:00:00    240    11.8    3.8    7    994.4    9.9

hopefully someone can help me how to do it

Moderator's Comments:
Mod Comment Double post, continued here, thread closed

Last edited by pludi; 02-03-2011 at 05:58 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

A beginner for cygwin simple question

the current pwd is: c:\cygwin\home\hui which command can go to c:\documents and setting\hui\my documents\hui\reply.txt (1 Reply)
Discussion started by: zhshqzyc
1 Replies

2. UNIX for Dummies Questions & Answers

beginner redirect question

How can I redirect all stdout and stderr messages from a command to /dev/null (or to a file if need be) except messages that start with the word 'foo'? Messages that start with 'foo' need to be displayed in real time (i.e., when they are sent to stdout/stderr by the command). Thanks. (5 Replies)
Discussion started by: darwin_886
5 Replies

3. Shell Programming and Scripting

Beginner Shell Programming Question

Hello all, I am currently try to learn the linux operating system as well as some bash programming. I have come across some online course work which has been very helpful, I have been working through some assignments and since I have no teacher to ask I have come to you experts. So the... (6 Replies)
Discussion started by: g2axiom
6 Replies

4. Shell Programming and Scripting

beginner's question

i write a shell program and i execute that after i made a bin directiry in my home directory(i didnt give any permissions) now i change to other directory.then i execute it bit it is saying " no such a file or directory" can any one help me please (2 Replies)
Discussion started by: wkbn86
2 Replies

5. Shell Programming and Scripting

sed beginner question

Hello, I am processing data. In the first column there is the date ("2011 02 03 12 45") separated by space and follow I have the measurements.I have several days in one file. What I would like to do is: to read the data line by line and write the data of "today" in a new file and "yesterday" as... (13 Replies)
Discussion started by: jurgen
13 Replies

6. Shell Programming and Scripting

Beginner Question

Hello, I am new to shell scripting. I have a question I would greatly appreciate any suggestions on. I am writing a ksh script that will launch bin files. The files are owned root and the application runs under root. The application administrators do not get root access. The script is intended... (1 Reply)
Discussion started by: inakajin
1 Replies

7. Shell Programming and Scripting

pls help kinda difficult question for a beginner

1. Create a directory script (project_dir.sh) · Write a script in your home directory to create a subdirectory called “PROJECT<99>” within your home directory on the Ubantu/Linux server. <99> is your project number (e.g. 01,02,03, ... 15). · The script must test whether... (1 Reply)
Discussion started by: bugenhagen_
1 Replies

8. Shell Programming and Scripting

Beginner Question about 2 specific functions

My professor has given me a couple of functions that I am to use to accomplish the task of replacing spaces in file and/or directory names with hyphens. (i.e. A B/C D/E F and you want to rename that to A B/C D/E-F would be an example of changing the file and leaving the directories) These are... (1 Reply)
Discussion started by: Skittlybop
1 Replies

9. Shell Programming and Scripting

C shell - a question of a beginner

Hi, can someone explain how this aliases work: alias m 'if ( \!:$ =~ *gz) set status = 1 && most \!:$ || gzcat \!:1 | most ' I mean, I know what it does, but I don't know how - what is \!:$ and \!:1 - how do it used the && and || - what it does with status variable? thanks (3 Replies)
Discussion started by: tzvikao
3 Replies

10. Shell Programming and Scripting

Beginner Bash Scripting Question

Hello, I am new to Linux and studying to become a Unix System Admin. I am taking a course in which I was practicing creating a bash script to ping a particular IP address. The script can be found below: #/bin/bash echo "Enter the IP address" read ip if then ping -c 1 $ip if ;... (3 Replies)
Discussion started by: shah9250
3 Replies
Config::Model::CursesUI(3pm)				User Contributed Perl Documentation			      Config::Model::CursesUI(3pm)

NAME
Config::Model::CursesUI - Curses interface to edit config data SYNOPSIS
use Config::Model ; use Config::Model::CursesUI ; my $model = Config::Model -> new ; my $inst = $model->instance (root_class_name => 'XXX', instance_name => 'yyy'); # create dialog my $dialog = Config::Model::CursesUI-> new ( experience => 'beginner', # or 'advanced' ) ; # start never returns $dialog->start($model) ; DESCRIPTION
This class provides a Curses::UI interface to configuration data managed by Config::Model. IMPORTANT: Once the CursesUI object is created, STDOUT and STDERR are managed by the Curses interface, so all print and warn will not work as expected. CONSTRUCTOR
The constructor accepts the following parameters: experience Specifies the experience level of the user (default: "beginner"). The experience can be "master advanced beginner". load Subroutine ref containing the code to load the configuration data from the configuration files. This may overrides loading mechanism specified in the model with Config::Model::AutoRead. This sub is called without any arguments. store Subroutine ref containing the code to store the configuration data in the configuration files. This may overrides writing mechanism specified in the model with Config::Model::AutoRead. This sub is called without any arguments. AUTHOR
Dominique Dumont, (ddumont at cpan dot org) LICENSE
Copyright (c) 2007-2009,2011 Dominique Dumont. This file is part of Config-Model. Config-Model is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. Config-Model is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Public License for more details. You should have received a copy of the GNU Lesser Public License along with Config-Model; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA SEE ALSO
Config::Model, Config::Model::ObjTreeScanner, Curses::UI, Curses perl v5.10.1 2011-03-04 Config::Model::CursesUI(3pm)
All times are GMT -4. The time now is 07:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy