Sponsored Content
Top Forums Shell Programming and Scripting Help need to cut the first word of a line in text file Post 302329424 by kshji on Saturday 27th of June 2009 01:35:17 PM
Old 06-27-2009
Using regexp, replace using nothing start of line all those chars which are not space.
Example done using sed.
Code:
sed "s/^[^ ]* //" file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

2. Shell Programming and Scripting

cut last line of a word

Hi all, want to delete a crahecter from each line..? how can i do it... (2 Replies)
Discussion started by: bullz26
2 Replies

3. Shell Programming and Scripting

how to cut a field of a line in a text file?

Hi, I have text file which contains lines like : a/a/a/a/.project b/b/b/b/b/.project c/c/c/.project d/.project e/e/e/e/.project i want for all lines the last word .project should be removed and the file should look like : a/a/a/a/ b/b/b/b/b/ c/c/c/ .... how to proceed... (7 Replies)
Discussion started by: bhaskar_m
7 Replies

4. Shell Programming and Scripting

How to cut first line only from a text near a specific column without cutting a word

First I have to say thank you to this community and this forum. You helped me very much builing several useful scripts. Now, I can't get a solution the following problem, I'm stuck somehow. Maybe someone has an idea. In short, I dump a site via lynx and pipe the output in a file. I need to... (7 Replies)
Discussion started by: lowmaster
7 Replies

5. Shell Programming and Scripting

Script to cut the first word in Message Text

Hi, In my shell script, I am connecting to database and querying multiple columns in a table. MESSAGE_TEXT=`sqlplus -s /nolog <<end_log_stmt set heading off set feedback off set verify off set termout off set pages 0 CONNECT APPS/$USER_PWD Select order_number, id, error_message... (6 Replies)
Discussion started by: balajiora
6 Replies

6. Shell Programming and Scripting

cut the second line in a text file

Hi I have some problem to cut out the second line in a output file and send to a new file it's a #!/bin/bash script 1 something 2 something 3 something and after I cut 1 something 3 something New file 2 something Thanks in advance (7 Replies)
Discussion started by: pelle
7 Replies

7. Shell Programming and Scripting

[Bash]Attempting to Merge text from one file into another file at the line directly under a word

Hello, This is my first post on the forums. So I want to start by thanking anyone who is kind enough to read this post and offer advise. I hope to be an active contributor now that I've found these forums. I have an issue that I figure would be a good first post.. I have 2 text files... (5 Replies)
Discussion started by: efciem
5 Replies

8. Shell Programming and Scripting

How to find and print the last word of each line from a text file

Can any one help us in finding the the last word of each line from a text file and print it. eg: 1st --> aaa bbbb cccc dddd eeee ffff ee 2nd --> aab ered er fdf ere ww ww f the o/p should be a below. ee f (1 Reply)
Discussion started by: naveen_sangam
1 Replies

9. Shell Programming and Scripting

get the fifth line of a text file into a shell script and trim the line to extract a WORD

FOLKS , i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one. thanks... Venu (3 Replies)
Discussion started by: venu
3 Replies

10. Shell Programming and Scripting

Grep to isolate a text file line and Awk to select a word?

I am looking at using grep to locate the line in the text file and them use awk to select a word or words out of it. I know awk needs -v to allow a variable to be used, but also needs -F to allow the break up of the sentence and allow the location of separate variables. $line = grep "1:" File |... (8 Replies)
Discussion started by: Ironguru
8 Replies
Algorithm::Dependency::Source::File(3pm)		User Contributed Perl Documentation		  Algorithm::Dependency::Source::File(3pm)

NAME
Algorithm::Dependency::Source::File - File source for dependency heirachys DESCRIPTION
Algorithm::Dependency::Source::File implements a source where the items are stored in a flat file or a relatively simple format. File Format The file should be an ordinary text file, consisting of a series of lines, with each line completely containing the information for a single item. Blank lines, or lines beginning with the hash character '#' will be ignored as comments. For a single item line, only word characters will be used. A 'word character' consists of all letters and numbers, and the underscore '_' character. Anything that is not a word character will be assumed to be a seperator. The first word will be used as the name or id of the item, and any further words in the line will be used as other items that this one depends on. For example, all of the following are legal. # A single item with no dependencies Foo # Another item that depends on the first one Bar Foo # Depending on multiple others Bin Foo Bar # We can use different seperators One:Two|Three-Four+Five=Six Seven # We can also use multiple non-word characters as seperators This&*&^*&File: is& & & :::REALLY()Neat From the examples above, it should be easy to create your own files. METHODS
This documents the methods differing from the ordinary Algorithm::Dependency::Source methods. new $filename When constructing a new Algorithm::Dependency::Source::File object, an argument should be provided of the name of the file to use. The constructor will check that the file exists, and is readable, returning "undef" otherwise. SUPPORT
To file a bug against this module, use the CPAN bug tracking system http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Algorithm-Dependency <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Algorithm-Dependency> For other comments, contact the author. AUTHOR
Adam Kennedy <adamk@cpan.org> SEE ALSO
Algorithm::Dependency COPYRIGHT
Copyright 2003 - 2009 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.12.4 2009-04-14 Algorithm::Dependency::Source::File(3pm)
All times are GMT -4. The time now is 02:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy