Sponsored Content
Full Discussion: split string
Top Forums Shell Programming and Scripting split string Post 302658323 by maddog21 on Tuesday 19th of June 2012 07:00:48 AM
Old 06-19-2012
Quote:
Originally Posted by ygemici
what is your full input ?
Do you mean the actual body?

---------- Post updated at 09:00 PM ---------- Previous update was at 08:51 PM ----------

Quote:
Originally Posted by elixir_sinari
Just changing your awk program a bit:

Code:
awk '/Content-Type/{p=1;c++;printf("\n%s%s ","Email-",c);}/Date/{p=0}p{printf("%s ",$0)} END{print}' file

It is not printing the emails one after another line by line? it is still breaking the long emails.

thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

split a file at a specified string

to find log files modification, i want to select all the lines of a file behind a string (found by grep ?). :rolleyes: (6 Replies)
Discussion started by: jpl35
6 Replies

2. Shell Programming and Scripting

split a string

Hi I have a script that loops though lines of a file and reads each line in to a variable ($LINE). I want to look at the line and split it into it's constituent parts. e.g. a line might be "This is a string" I want to then have variables set to each element thus: A=This B=is C=a... (3 Replies)
Discussion started by: gazingdown
3 Replies

3. Shell Programming and Scripting

split string help

could anyone help in running split cmd split("String1,outputArray,"delimiter); with sample script?. for eg i have abc-def-ghi-sdf- my ultimate aim of asking this is i have a string containing hypens, i want to get the string before last n(2) Hypens (4 Replies)
Discussion started by: senthilk615
4 Replies

4. Shell Programming and Scripting

Split A String

Hi, I am new to scripting and need help splitting a string using space as the delimiter. How can I do that? I want the result to be stored in an Array. I tried using set -A arr $(echo $FILE) echo $arr The result of the above was ''. Thanks. (2 Replies)
Discussion started by: newbie187
2 Replies

5. Shell Programming and Scripting

split the string

I need to split the string msu1_2 It should be generic for any string of the form msu<digits>_<digits> so that i get $X =1 and $Y = 2 Please help Thanks (5 Replies)
Discussion started by: asth
5 Replies

6. Shell Programming and Scripting

Split string

Hi, can we split a number like this.. if i have something like 85743975945738, can it be converted as 8574-3975-945738 in ksh shell using single command... Thanks! (5 Replies)
Discussion started by: nram_krishna@ya
5 Replies

7. Shell Programming and Scripting

split string

Hi I am facing a problem in spitting a string. Here is the string -------------------- subject1=10;subject2=30;subject3=40;subjectcode=10001;... Now, I want only marks not the subject code. (there can be 'n' subjects) ie. 10 30 40 My doubt ---------- How do I... (5 Replies)
Discussion started by: jionnet
5 Replies

8. Shell Programming and Scripting

Need to split a string

Hi, We have a SunOS 5.10 Generic_142900-13 sun4v sparc SUNW,T5240. I'm trying to find a way to split a string into 2 variables. Ex: parm1="192.168.1.101/parent/child" What I need to do is split the string above into: host="192.168.1.101" location="parent/child" I saw the... (3 Replies)
Discussion started by: adshocker
3 Replies

9. Shell Programming and Scripting

Split the string in perl

Hi All, How to split the string KAR_Celltick_Ban_GSMGW3 and want to pickup the third filed. Sometime the string may be "KAR_Celltick_Ban" like this Thanks in advance (1 Reply)
Discussion started by: sujit_kashyap
1 Replies

10. UNIX for Beginners Questions & Answers

How to split a string into array?

value=malayalam # i need to store the value in an array by splitting the character #the output i need is m a l a y a l a m Please use CODE tags for output data as well as required by forum rules! (5 Replies)
Discussion started by: Meeran Rizvi
5 Replies
MAILINSPECT(1)															    MAILINSPECT(1)

NAME
mailinspect - sort an mbox by category and pipe emails to a command. SYNOPSIS
mailinspect [-zjiI] -c category FILE [-gG regex]... [-s command] [-p style] [-o scoring] mailinspect -V DESCRIPTION
mailinspect reads the single mbox folder named FILE and sorts it in order of similarity to the category, which must have been created by dbacl(1). It can be used as a command line tool or interactively, when given the -I switch. When used as a command line tool, mailinspect prints the sorted list of emails on STDOUT. Each line consists of a seek position for the given email within FILE, followed by the score and a description string in one of several styles chosen via the -p option. When supplying a command string in conjunction with the -s option, mailinspect spawns a shell and executes command for every email in FILE (possibly selected via the -g or-G options), in the sorted order. This is similar to the formail(1) functionality, except the latter doesn't order the emails. In interactive mode, all the command line functionality is available via keypresses. The sorted list of emails is displayed in a scrollable format, and can be viewed, searched, tagged, resorted and sent to shell commands. Predefined shell commands can be associated with function keys. See the usage section below. The sorting heuristics are currently (and may always be) experimental, so there is no guarantee that the orderings are particularly well suited for anything. EXIT STATUS
mailinspect returns 1 on success, 0 if some error occurred. OPTIONS
-c Use category to compute the scores and sort the emails, which should be the file name of a dbacl(1) category. -g Only emails matching the regular expression regex are sorted. All other emails are ignored. When several -g and -G options are present on the command line, earlier regular expressions are overridden by later ones where applicable. -i Force internationalized mode. -j Force regular expression searches to be case sensitive. -o Determines the scoring formula to be used. The parameter scoring must be an integer greater than or equal to zero. By default, scor- ing equals zero. -p Prints the email index in the given style. The parameter style must be an integer greater than or equal to zero. By default, style equals zero. -s For each email in the list, execute the shell command, with the email body on STDIN. Emails are processed in sorted order. -z Reverse sort order. Normally, emails are sorted in order of closest to furthest relative to category, but in this case, the opposite is true. -I Interactive mode. Instead of printing the sorted list of emails on STDOUT, emails are displayed and can be scrolled, viewed, searched and piped interactively at the terminal. -G Only emails not matching the regular expression regex are sorted. Opposite of -g switch. -V Print the program version number and exit. USAGE
mailinspect needs to read a prelearned category before it can sort the emails in FILE. See dbacl(1). Suppose you have two mail folders named good.mbox and bad.mbox respectively. You can create appropriate categories by typing the commands % dbacl -l good good.mbox -T email % dbacl -l bad bad.mbox -T email Next, you can type the following command to view interactively the bad.mbox file with the emails whose score is closest to the category good listed first: % mailinspect -I -c good bad.mbox Alternatively, you might be interested only in the five emails in the folder bad.mbox whose score marks them as the furthest away from the category bad, completely independently from any other category such as good (ie you want outliers in the scoring sense). % mailinspect -z -c bad bad.mbox | head -5 In interactive mode, the following keys are defined: o toggles another scoring formula. p toggles another display style. q exits mailinspect. s sends the currently highlighted email to a shell command. S sends all currently tagged emails to a shell command, in sorted order. Every email executes the shell command independently. t tags the currently highlighted email. T tags all listed emails. v sends the currently highlighted email to $PAGER for viewing. If the environment variable PAGER is not defined, sends the email to less(1). u untags the highlighted email. U untags all listed emails. z reverses the sort order of displayed emails. / searches for a regular expression (see regex(7)) anywhere within the contents of all listed emails. Hides all emails which don't match. ? like /, but hides all emails which match, keeping all those which don't match. As a convenience, the function keys F1-F10 can each be associated with a shell command string. In this case, typing a function key has the same effect as the S key, but the command is already typed and ready to be edited/accepted. The function key associations are read from the configuration file .mailinspectrc if it exits. FILES
$HOME/.mailinspectrc mailinspect reads the file .mailinspectrc in the $HOME directory, if it exists. This is a plain text file which contains entries of the form # this is a comment F2 cat >> interesting.mbox F5 mail zarniwoop@megadodo.com ENVIRONMENT
DBACL_PATH When this variable is set, its value is prepended to every category filename which doesn't start with a '/'. SOURCE
The source code for the latest version of this program is available at the following locations: http://www.lbreyer.com/gpl.html http://dbacl.sourceforge.net AUTHOR
Laird A. Breyer <laird@lbreyer.com> SEE ALSO
bayesol(1), dbacl(1), less(1), mailcross(1), regex(7) Version 1.12 Bayesian Text Classification Tools MAILINSPECT(1)
All times are GMT -4. The time now is 03:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy