11-29-2010
extracting specific text from lines
Hello,
i've got this output text:
Quote:
36K /tmp/hsperfdata_root
4.0K /tmp/libstorage-KCA9un
4.0K /tmp/.X11-unix
4.0K /tmp/orbit-root
8.0K /tmp/ksocket-root
4.0K /tmp/.ICE-unix
12K /tmp/kde-root/closeditems
56K /tmp/kde-root
4.0K /tmp/kde-test/closeditems
16K /tmp/kde-test
8.0K /tmp/ksocket-test
184K /tmp/VMwareDnD/a469da9e
184K /tmp/VMwareDnD/f99c770f
1.7M /tmp
and i need it to look something like this:
Quote:
36K hsperfdata_root
4.0K libstorage-KCA9un
4.0K .X11-unix
4.0K orbit-root
8.0K ksocket-root
4.0K .ICE-unix
12K closeditems
56K kde-root
4.0K closeditems
16K kde-test
8.0K ksocket-test
184K a469da9e
184K f99c770f
which means that there won't be absolute path of each directory, just it's size and the last word after last '/' in each line, and i also don't need last line '1.7M /tmp'
Looks like there is a simple solution for that, but i'm only a beginner to linux, so i'll apreciate any help.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear All,
I have to extract a a few lines from a log file and I know the starting String and end string(WHich is same ). Is there any simplere way using sed - awk.
e.g. from the following file
--------------------------------------
Some text
Date: 21 Oct 2008
Text to be extracted... (8 Replies)
Discussion started by: rahulkav
8 Replies
2. Shell Programming and Scripting
I'm extremely new to scripting and linux in general, so please bear with me. The class I'm taking gives virtually no instruction at all, and so I'm trying to learn everything off the web.
Anyway, I'm trying to extract characters that follow after a specific pattern ( '<B><FONT FACE="Arial">' ) but... (3 Replies)
Discussion started by: livos23
3 Replies
3. Shell Programming and Scripting
Hi,
I have a file like
LAHORE 2009-04-16 16:04:19 THU
S5830 FAULT MESSAGE SUPPRESS STATUS
LOC : ASP00
STS : SUPPRESSING CONTINUE
INF : F6201 TRUNK. DATA FAULT REPORT
COMPLETED
LAHORE 2009-04-16 16:04:20 THU
S8400 ISUP SIGNALLING TRACE -... (3 Replies)
Discussion started by: krabu
3 Replies
4. Shell Programming and Scripting
Hi all! Im trying to extract a portion of text from a file and put it into a new file. I need all the lines between <Placement> and </Placement> including the Placemark lines themselves. Is there a way to extract all instances of these and not just the first one found? I've tried using sed and... (4 Replies)
Discussion started by: Grizzly
4 Replies
5. Shell Programming and Scripting
hi all,
i searched in unix.com and accquired the following commands for extracting specific lines from a file ..
sed -n '16482,16482p' in.sql > out.sql
awk 'NR>=10&&NR<=20' in.sql > out.sql....
these commands are working fine if i give the line numbers as such .. but if i pass a... (2 Replies)
Discussion started by: sais
2 Replies
6. Shell Programming and Scripting
Hi,
I have one file, say file 1, that has data like below where 19900107 is the date,
19900107 12 144 129 0.7380047
19900108 12 168 129 0.3149017
19900109 12 192 129 3.2766666E-02
... (3 Replies)
Discussion started by: Wynner
3 Replies
7. Shell Programming and Scripting
I have this input file:
and the desired output is as follows:
Desired Output
This is a sample taken from a huge file. Basically, the script should take the tag (TDK11..1>) add everything that has bukle=A until it sees the blank lines. Then takes the next tag (TDK2222>) adds everything that... (4 Replies)
Discussion started by: Ernst
4 Replies
8. UNIX for Dummies Questions & Answers
I have a table to data which one of the columns include string of text
from within that, I am searching to include few lines but not others
for example I want to to include some combination of word address such as (address.| address? |the address | your address) but not (ip address | email... (17 Replies)
Discussion started by: A-V
17 Replies
9. UNIX for Advanced & Expert Users
Hello,
Is there a quick awk one-liner for this extraction?:
file1
49389 text55
52211 text66
file2
59302 text1
49389 text2
85939 text3
52211 text4
13948 text5
Desired output
49389 text2
52211 text4
Thanks!! (5 Replies)
Discussion started by: palex
5 Replies
10. UNIX for Dummies Questions & Answers
I need help extracting specific lines in a text file. The file looks like this:
POSITION TOTAL-FORCE (eV/Angst)
-----------------------------------------------------------------------------------
1.86126 1.86973 1.86972 ... (14 Replies)
Discussion started by: captainalright
14 Replies
LEARN ABOUT DEBIAN
e2tools
E2TOOLS(7) Miscellaneous Information Manual E2TOOLS(7)
NAME
e2tools - utilities to manipulate files in an ext2/ext3 filesystem
DESCRIPTION
E2tools is a simple set of GPL'ed utilities to read, write, and manipulate files in an ext2/ext3 filesystem. These utilities access a
filesystem directly using the ext2fs library. I wrote these tools in order to copy files into a linux filesystem on a machine that does not
have ext2 support. Of course, they can also be used on a linux machine to read/write to disk images or floppies without having to mount
them or have root access.
Supported functionality:
e2cp copy files
e2mv move files
e2rm remove files
e2mkdir
create directory
e2ln create hard links
e2ls list files/directories
e2tail output the last part of a file
In general, to specify a directory or file on an ext2 filesystem for the e2tools utilities, use the following form:
filesystem:directory_path
The filesystem can be an unmounted partition or a regular file that's been formatted to contain an ext2 filesystem. In general, if a com-
mand takes multiple file names on the command line, if the first one contains an ext2 file specification, the rest of the files are assumed
to be on the same filesystem until another one is explicitly stated:
/tmp/boot.img:/tmp/file1
/tmp/file2
/tmp/file3
/tmp/boot2.img:/tmp/file4
Files 1-3 are on /tmp/boot.img and the last file is on /tmp/boot2.img
SEE ALSO
e2cp(1), e2ln(1), e2ls(1), e2mkdir(1), e2mv(1), e2rm(1), e2tail(1).
AUTHOR
The e2tools were written by Keith Sheffield <sheff@pobox.com>.
This manual page was written by Lucas Wall <lwall@debian.org>, for the Debian project (but may be used by others).
March 2, 2005 E2TOOLS(7)