Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Unix: File manipulation

Original Message
Name: esu (by Raj)
Date: June 14, 2007 at 10:14:02 Pacific
Subject: Unix: File manipulation
OS: Linux
CPU/Ram: 64
Model/Manufacturer: red
Comment:
Hi All,

Could somone suggest the solution for this problem?

The problem is that I have a abc.txt file in following format. Requiremnt is to:
1) get rid of top(first)line from file.
2) remove the extra white space from beginning of each line in file.
3) Remove the white space after word 'status' and before 'time' is displayed.

Here's how current file looks like:

NameTestsErrorsFailuresTime(s)
testLoginInitialLoad Success 7.938
testFailedSignOn Success 7.156
testLoginSignOn Success 8.078
testHomeTabNone Success 16.469

==================================
expected output should be :

testLoginInitialLoad Success 7.938
testFailedSignOn Success 7.156
testLoginSignOn Success 8.078
testHomeTabNone Success 16.469


==================================

You may not see the space in inmessage I posted but assume that there's space at beginning of each line and extra space after status.


Report Offensive Message For Removal


Response Number 1
Name: nails
Date: June 14, 2007 at 22:53:11 Pacific
Subject: Unix: File manipulation
Reply: (edit)
Look at Eric Pement's sed one-liners. I think he answers all of your questions:

http://www.student.northpark.edu/pe...


Report Offensive Follow Up For Removal

Response Number 2
Name: Shell_Life
Date: June 25, 2007 at 12:52:50 Pacific
Subject: Unix: File manipulation
Reply: (edit)
1) get rid of top(first)line from file:
tail +2 input_file

2) remove the extra white space from beginning of each line in file:
sed 's/^ //' input_file

3) Remove the white space after word 'status' and before 'time' is displayed.
sed 's/status /status/' input_file


Informix/4GL


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Unix: File manipulation

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




DSHUB24 Connection Problems

need help with dsl and dial up

novel 3.12

help mandriva install last straw!

Icon Scaling in Explorer Bar


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC