Print a portion of a line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Print a portion of a line
Prev   Next
# 1  
Old 10-10-2008
Print a portion of a line

Hi,
I am facing a little problem...
I have a line like this :
asdcvashfasashXXXXxxxzxcadd:sdcashjqdasdsmgdkdaxdsnd;
I want to print just a portion of line i.e starting from left 5 characters from ":" and upto ";" i.e. in this case it would be
"xcadd:sdcashjqdasdsmgdkdaxdsnd;"
The length of right most string can vary but end with ";".
Also what to do if I want to print just 5 character left to ";"

Thanks in advance.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Extract a portion of string from each line in Linux

Hi I have to extract the destination path information from each record the file is of variable length so I will not be able to use the print command.The search should start on variable "destinationPath" and it should end at immediate "," also the first field has to be printed Input File:... (7 Replies)
Discussion started by: rkakitapalli
7 Replies

2. UNIX for Beginners Questions & Answers

awk - If field value of consecutive records are the identical print portion of lines

I have some data that looks like this: PXD= ZW< 1,6 QR> QRJ== 1,2(5) QR> QRJ== 4,1(2) QR> QRJ== 4,2 QRB= QRB 4,2 QWM QWM 6,2 R<C ZW< 11,2 R<H= R<J= 6,1 R>H XZJ= 1,2(2) R>H XZJ= 2,6(2) R>H XZJ= 4,1(2) R>H XZJ= 6,2 RDP RDP 1,2 What I would like to do is if fields $1 and $2 are... (5 Replies)
Discussion started by: jvoot
5 Replies

3. Shell Programming and Scripting

Shell to display portion of a line

Thanks a lot for the code and the explanation. Now my final requirement. I have uploaded 3 files as attachment. Please open the files in Editplus or any other text editor which keeps the formatting. GMDCOM.27936.log.txt------I want to pick only Process request from this file.(Please check... (9 Replies)
Discussion started by: ghosh_tanmoy
9 Replies

4. Shell Programming and Scripting

How to grep a portion of line

Mysql log has something like: I want to grep only the portion "ernie-1328697839.1233158" from each line. How to do this? (6 Replies)
Discussion started by: proactiveaditya
6 Replies

5. Shell Programming and Scripting

Print portion line in SED

Hi, This is more a theoretical question, because I usually solved that with perl or even java, but I would like to know if it exists an easy way to do it with SED. Using regular expresions it's very easy to select an portion line. Does it exist an easy way for printing those portions in SED?... (1 Reply)
Discussion started by: islegmar
1 Replies

6. UNIX for Dummies Questions & Answers

Print a portion of file

Hi, I have a little problem. I am having a file with pattern like : asdf;ffgg;dfjfj;djdfjf;nnjj;djd;ssj; I just want to print the portion from last ";" upto the immediate previous ";". There are several ";" in my line. Please help me out... Thnx in advance (8 Replies)
Discussion started by: vanand420
8 Replies

7. Shell Programming and Scripting

Delete a portion of a line using shell scripting

Hi all, I am new to awk programs.I have a file like this 1234567@2345||adcbdefhij: asgdfdasdfhhfd-asdfasd-dsfasdf |0.678|0.0|0.213 1234567@2345||adcbdefhij: ashhfd-asdfasd-dsfasdf |0.129|0.0|0.411 1234567@2345||adcbdefhij: asd-aasd-dasdf |0.223|0.0|0.276 I want to delete the text which... (3 Replies)
Discussion started by: Loy81
3 Replies

8. Shell Programming and Scripting

awk program to select a portion of a line

Hi all, I am new to awk programs.I have a file like this vjfavhjlaf<LTEXT>aabcdfffvvbbxbcddjbv</LTEXT>fAFdfdADfd vjfavhjlaf<LTEXT>aabcdfffvvbbxbcddjbv</LTEXT>fAFdfdADfd vjfavhjlaf<LTEXT>aabcdfffvvbbxbcddjbv</LTEXT>fAFdfdADfd vjfavhjlaf<LTEXT>aabcdfffvvbbxbcddjbv</LTEXT>fAFdfdADfd... (3 Replies)
Discussion started by: anju
3 Replies

9. UNIX for Dummies Questions & Answers

erasing portion of line with sed (only once)

hi, I'm trying to use sed to erase everything, up to the first parenthesis. for example: input: blah blah blah (aldj) test (dafs) test test. output: (aldj) test (dafs) test test. how would i do this? I was fooling around with the parenthesis, and i only got it to apply on all parenthesis.... (1 Reply)
Discussion started by: gammaman
1 Replies

10. UNIX for Dummies Questions & Answers

erasing portion of line with sed

hi, I'm trying to use sed to erase everything, and including the ending parenthesis. For example: input: blah blah blah (12355)this is what i want. output: this is what i want. how would i do this? i found an example online that does the opposite: sed \"s|test.*||g\" file1 > file2"; ... (5 Replies)
Discussion started by: gammaman
5 Replies
Login or Register to Ask a Question
NMBSTATUS(1)						User Contributed Perl Documentation					      NMBSTATUS(1)

NAME
nmbstatus - Lists NMB node status of a UDP network SYNOPSIS
nmbstatus [options] Options: --workgroup --pdc --bdc --lmb --dmb --members --quiet --allworkgroups --winsserver --print0 --debug --help --man GENERAL OPTIONS
--help Print a brief help message and exits.Prints a help message. --man Print the manual page and exit. --print0 Use '' instead of a tab stop as seperator between the output. --debug Use an debuglevel. No debuglevel available yet. GENERAL ARGUMENTS
--workgroup Perform all actions on this workgroup name. If no workgroup is set the information off all available groups is shown. --pdc If not called in conjunction with --quiet print a line starting with the acronym PDC followed by the seperator and the netbios name of the PDC if one is available. If not print nothing and return with 1. --bdc If not called in conjunction with --quiet print a line starting with the acronym BDC followed by the seperator and the netbios name of the BDC if one is available. If not print nothing and return with 1. --dmb If not called in conjunction with --quiet print a line starting with the acronym DMB followed by the seperator and the netbios name of the DMB if one is available. If not print nothing and return with 1. --lmb If not called in conjunction with --quiet print a line starting with the acronym LMB followed by the seperator and the netbios name of the LMB if one is available. If not print nothing and return with 1. --members If not called in conjunction with --quiet print a line starting with the word MEMBERS followed by the seperator and the netbios names of the workgroup members. If not print nothing and return with 1. --quiet Don't print any information. Just return with 0 if a type - pdc, lmb, dmb, or members was found. Else return 1. --allworkgroups List all available workgroups. --winsserver Use this WINS server to gather the information. DESCRIPTION
nmbstatus will detect workgroups, PDCs, BDCs, DMBs, LMBs, and Members of workgroups in your network. If more than one type is specizied but only one result found, nmbstatus nevertheless returns 0. AUTHOR
Lars Mueller <lmuelle@suse.de> If you find any errors in the code please let me know. COPYRIGHT
Copyright (c) 2003-2004 SuSE Linux AG. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 339: You forgot a '=back' before '=head1' Around line 341: '=item' outside of any '=over' perl v5.12.1 2009-01-02 NMBSTATUS(1)