Sponsored Content
Top Forums Shell Programming and Scripting awk script to split a file based on the condition Post 74858 by superprogrammer on Tuesday 14th of June 2005 12:56:37 AM
Old 06-14-2005
Thanks vino, it worked
I have one more question
If the file is like this
WSRTK10000000000000067839904809787489959595924667889USMNC
WSRTK10000893479900006783990480978748995959592466673CNATT
WSRTK10000893472387462342349899000067839904809787455USAPT
I know that the last 5 characters in each line is my search pattern and my problem remains the same
I want lines containing patterns like USMNC to go to US_MNC etc
Can I extract last few characters of each line in awk?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to split the String based on condition?

hi , I have a String str="/opt/ibm/lotus/ibw/latest" or ="/opt/lotus/ibw/latest" this value is dynamic..I want to split this string into 2 strings 1. /opt/ibm/lotus(/opt/lotus) this string must ends with "lotus" 2./ibw/latest can any body help me on this? Regards, sankar (2 Replies)
Discussion started by: sankar reddy
2 Replies

2. Shell Programming and Scripting

Split a file based on pattern in awk, grep, sed or perl

Hi All, Can someone please help me write a script for the following requirement in awk, grep, sed or perl. Buuuu xxx bbb Kmmmm rrr ssss uuuu Kwwww zzzz ccc Roooowwww eeee Bxxxx jjjj dddd Kuuuu eeeee nnnn Rpppp cccc vvvv cccc Rhhhhhhyyyy tttt Lhhhh rrrrrssssss Bffff mmmm iiiii Ktttt... (5 Replies)
Discussion started by: kumarn
5 Replies

3. Shell Programming and Scripting

split file with condition

$ cat file H1:12:90 k:12:b n:22:i k:54:b k:42:b s:48:s a:41:b t:18:n c:77:a I am trying to split above file based on $2 such that if $2 is rounded to nearest 10's multiple (e.g. 10,20,30 etc), each sub file should contain 3 multiples and so on (also I want to keep header i.e. NR==1, in... (6 Replies)
Discussion started by: uwork72
6 Replies

4. Shell Programming and Scripting

Split file based on file size in Korn script

I need to split a file if it is over 2GB in size (or any size), preferably split on the lines. I have figured out how to get the file size using awk, and I can split the file based on the number of lines (which I got with wc -l) but I can't figure out how to connect them together in the script. ... (6 Replies)
Discussion started by: ssemple2000
6 Replies

5. Shell Programming and Scripting

How to split file into multiple files using awk based on 1 field in the file?

Good day all I need some helps, say that I have data like below, each field separated by a tab DATE NAME ADDRESS 15/7/2012 LX a.b.c 15/7/2012 LX1 a.b.c 16/7/2012 AB a.b.c 16/7/2012 AB2 a.b.c 15/7/2012 LX2 a.b.c... (2 Replies)
Discussion started by: alexyyw
2 Replies

6. Shell Programming and Scripting

awk script to split file into multiple files based on many columns

So I have a space delimited file that I'd like to split into multiple files based on multiple column values. This is what my data looks like 1bc9A02 1 10 1000 FTDLNLVQALRQFLWSFRLPGEAQKIDRMMEAFAQRYCQCNNGVFQSTDTCYVLSFAIIMLNTSLHNPNVKDKPTVERFIAMNRGINDGGDLPEELLRNLYESIKNEPFKIPELEHHHHHH 1ku1A02 1 10... (9 Replies)
Discussion started by: viored
9 Replies

7. Shell Programming and Scripting

How to Split File to 2 depending on condition?

Hi , cat myfile.txt ! 3100.2.0.5 ! 3100.2.22.4 ! 3100.2.30.33 ! 3100.2.4.1 ! ! 3100.2.0.5 ! 3100.2.22.4 ! 3100.2.22.11 ! 3100.2.4.1 ! ! 3100.2.0.5 ! 3100.2.2.50 ! 3100.2.22.11 ! 3100.2.4.1 ! ! 3100.2.0.5 ! 3100.2.22.4 ! 3100.2.30.33 ! 3100.2.4.1 ! ! 3100.2.0.5 ! 3100.2.22.4 !... (6 Replies)
Discussion started by: OTNA
6 Replies

8. Shell Programming and Scripting

awk to change contents of field based on condition in same file

In the awk below I am trying to copy the entire contents of $6 there may be multiple values seperated by a ;, to $8, if $8 is . (lines 1 and 3 are examples). If that condition $8 is not . (line2 is an example) then that line is skipped and printed as is. The awk does execute but prints the output... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. UNIX for Beginners Questions & Answers

awk to add +1 to value based on condition in input

In the awk below I am trying to add a | that will adjust $2 in the ouput by adding +1 if the original value from file that was used in $3 had a - in it. Line 3 of file is an example of this. In my current awk I just subtract one but I am not sure how to only apply this to those values without a -.... (5 Replies)
Discussion started by: cmccabe
5 Replies

10. UNIX for Beginners Questions & Answers

awk do not split if condition is meet

Trying to use awk to format the input based on the filed count being 5. Most lines are fine using the awk below, except the first two lines. I know the reason is the -1 in green and -2 in blue. But can not figure out how to not split on the - if it is followed by a digit then letter. Thank you :).... (1 Reply)
Discussion started by: cmccabe
1 Replies
PHONE(1)						      General Commands Manual							  PHONE(1)

NAME
phone - Phone utility for DECnet SYNOPSIS
phone [options] Options: [-vVh] [-s switchhook char] [initial command] DESCRIPTION
phone is a program that allows the user to communicate interactively with users on VMS systems. Two user interfaces are available: X-Win- dows (GTK+) and terminal (ncurses). If X-Windows is available and compiled into phone then it will be used unless the -n flag is present on the command line. After entering the phone command you will be presented with the phone screen which has windows for the chat and a command-line at the top. If you are not talking to another user then you can enter commands directly, otherwise you will need to precede commands with the 'switch hook' character, which defaults to the percent sign (%). You can also enter a command for phone on the shell command-line. This command will be executed when phone starts up. This makes it conve- nient to enter commands such as: 'phone answer' or 'phone marsha::chrissie' In command mode phone understands several commands: DIAL <node::user> Call a user ANSWER Answer an incoming call REJECT Reject an incoming call EXIT or QUIT Return the the command prompt HOLD Hold all callers UNHOLD Unhold callers HANGUP Hangup the phone DIR <node> Show users logged into <node> FACSIMILE <file> Send <file> HELP Show this help All commands (apart from QUIT and EXIT) can be abbreviated to 3 characters and all (really all this time) commands are case insensitive. OPTIONS
-h -? Displays help for using the command. -V Show the version of phone. -s Set the switch hook character. This is the character used to switch from talking to another user and entering PHONE commands when using the terminal interface.x -n Disables use of the X-windows user interface. Use this to run phone in an xterm. SEE ALSO
phoned(8) DECnet utilities March 26 1999 PHONE(1)
All times are GMT -4. The time now is 07:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy