Sponsored Content
Top Forums Shell Programming and Scripting String searching and output to a file in a formatted text Post 302438505 by cuji on Tuesday 20th of July 2010 02:27:00 AM
Old 07-20-2010
Quote:
Originally Posted by rdcwayx
Code:
awk '/TTOH   8031950001/ {{for (i=2;i<=14;i++) printf $i FS} {printf "\n"}}' batch-host.log.6

hi rdc, thx for your prompt reply. i got "awk: Input line <Jun 29, 2010 5:24:3 cannot be longer than 3,000 bytes.
The input line number is 1. The file is batch-host.log.6.
The source line number is 1." message when running the script u provided. I tried to use below script instead:-

grep -h "TTOH 8031950001" *batch-host.log* |cut -d " " -f2-14 >test.log

but got attached output (missing 1st 4 bytes). Perhaps few items need to amended using above script?.

Thanks a lot ya..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Hi! Searching for a text string in UNIX

Hi! I'm new here and glad to meet everyone! I've been wrestling with a problem lately however! How do I recursively (recursive means to keep going through the subdirectories until no more are there) search a bunch of textfiles in a long directory structure for a specific string.. but only... (1 Reply)
Discussion started by: skwadim
1 Replies

2. Shell Programming and Scripting

Convert DATE string to a formatted text

Hi guys, i need your help. I need to convert a date like this one 20071003071023 , to a formated date like 20071003 07:10:23 . Could this be possible ? Regards, Osramos (6 Replies)
Discussion started by: osramos
6 Replies

3. Shell Programming and Scripting

Searching and extracting text from output

I have the following output which I need to obtain the values for "Next Seq is xxx" and "Last Seq is xxx" and "Pending count is xxx". You will notice that the number of words prior to that value can be variable hence the reason for asking this question. LINECMD> Line /xxx///ABC9_SND is UP.... (3 Replies)
Discussion started by: sjday
3 Replies

4. Shell Programming and Scripting

PERL: Searching for a string in a text file problem

Looking for a bit of help. I need to search for a string of words, but unfortunately these words are located on separate lines. for example the text output is: United Chanmpions Ronaldo Liverpool Losers Torres and my script code is print("DEBUG - checking file message"); while... (15 Replies)
Discussion started by: meevagh
15 Replies

5. UNIX for Dummies Questions & Answers

Output text from 1st paragraph in file w/ a specific string through last paragraph of file w/ string

Hi, I'm trying to output all text from the first paragraph in a file that contains a specific string through the last paragraph in that file that contains that string. Previously, I was outputting just each paragraph with that search string with: cat in_file | nawk '{RS=""; FS="\n";... (2 Replies)
Discussion started by: carpenn
2 Replies

6. Shell Programming and Scripting

searching a text string for n'th :

hello, i'm a novice on bsh scripting so thanks for any help here basically i have a shell var $x that looks like this > echo $x nabc1234:!:73394:17155:Gary Mason:/home/garym:/bin/ksh and i'm trying to keep the first 8 characters and the text from the 4th : to the 5th : i've been trying... (9 Replies)
Discussion started by: sasglm
9 Replies

7. Shell Programming and Scripting

Searching for a particular string and modifying text within block of data

Hi Forum. Is there a quick way to do the following search/replace within a block of data? I tried to google the solution but didn't really know what to look for. I have the following text file (I want to search for a particular string "s_m_f_acct_txn_daily_a1" and replace the... (5 Replies)
Discussion started by: pchang
5 Replies

8. Shell Programming and Scripting

searching a file with a specified text without using conventional file searching commands

without using conventional file searching commands like find etc, is it possible to locate a file if i just know that the file that i'm searching for contains a particular text like "Hello world" or something? (5 Replies)
Discussion started by: arindamlive
5 Replies

9. HP-UX

Formatted TOP command output in file

Hi All, I want generate HP-UX overall system performance report. I tried executing top command and write that out put to file. but am not able to view the report in proper format. I can see report like below in file but i can see properly in terminal. Please suggest how can i get... (2 Replies)
Discussion started by: lravip123
2 Replies

10. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies
String::Flogger(3pm)					User Contributed Perl Documentation				      String::Flogger(3pm)

NAME
String::Flogger - string munging for loggers VERSION
version 1.101242 SYNOPSIS
use String::Flogger qw(flog); my @inputs = ( 'simple!', [ 'slightly %s complex', 'more' ], [ 'and inline some data: %s', { look => 'data!' } ], [ 'and we can defer evaluation of %s if we want', sub { 'stuff' } ], sub { 'while avoiding sprintfiness, if needed' }, ); say flog($_) for @inputs; The above will output: simple! slightly more complex and inline some data: {{{ "look": "data!" }}} and we can defer evaluation of stuff if we want while avoiding sprintfiness, if needed METHODS
flog This method is described in the synopsis. format_string $flogger->format_string($fmt, @input); This method is used to take the formatted arguments for a format string (when "flog" is passed an arrayref) and turn it into a string. By default, it just uses ""sprintf" in perlfunc". AUTHOR
Ricardo SIGNES <rjbs@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ricardo SIGNES <rjbs@cpan.org>. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-03-26 String::Flogger(3pm)
All times are GMT -4. The time now is 07:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy