Sponsored Content
Full Discussion: Need help splitting file
Top Forums Shell Programming and Scripting Need help splitting file Post 302432344 by pseudocoder on Thursday 24th of June 2010 08:34:57 PM
Old 06-24-2010
Maybe so?
Code:
$ x=0
$ y=1
$ for z in 10001 20001 30001 40001 50001 60001; do
awk "NR>$x&&NR<$z" file > file-p$y
x=$(($x+10000))
y=$(($y+1))
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Splitting file] Extracting group of segments from one file to others

Hi there, I need to split one huge file into separate files if the condition is fulfilled according to that the position between 97 and 98 matches with “IT” at the segment MAS. There is no delimiter file is fix-width with varous line length. Could you please help me how I do split the file... (1 Reply)
Discussion started by: ozgurgul
1 Replies

2. UNIX for Dummies Questions & Answers

Splitting a file based on record sin another file

All, We receive a file with a large no of records (records can vary) and we have to split it into two files based on another file. e.g. File1: UHDR 2008112 "25187","00000022","00",21-APR-1991,"" ,"D",-000000519,+0000000000,"C", ,+000000000,+000000000,000000000,"2","" ,21-APR-1991... (7 Replies)
Discussion started by: er_ashu
7 Replies

3. Shell Programming and Scripting

splitting the file

Hi , I have one file which has many headers. Say suppose HEDAER ..data DATA DATA ..data ..data HEADER ..data ..data DATA .data HEADER. ..data ..data If there are 3 HEADERS in source file then I need to split the source file into 3 separate file.... (2 Replies)
Discussion started by: tanyaheerani
2 Replies

4. Shell Programming and Scripting

File splitting, naming file according to internal field

Hi All, I have a rather stange set of requirements that I'm hoping someone here could help me with. We receive a file that is actually a concatenation of 4 files (don't believe this would change, but ideally the solution would handle n files). The super-file looks like:... (7 Replies)
Discussion started by: Leedor
7 Replies

5. Shell Programming and Scripting

Splitting a file in to multiple files and passing each individual file to a command

I have an input file with contents like: MainFile.dat: 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 12247689|7896|77698080 16768900|hh78|78959390 ... (4 Replies)
Discussion started by: rkrish
4 Replies

6. UNIX for Dummies Questions & Answers

Extracting data from one file, based on another file (splitting)

Dear All, I have two files but want to extract data from one based on another... can you please help me file 1 David Tom Ellen and file 2 David|0010|testnamez|resultsz David|0004|testnamex|resultsx Tom|0010|testnamez|resultsz Tom|0004|testnamex|resultsx Ellen|0010|testnamez|resultsz... (12 Replies)
Discussion started by: A-V
12 Replies

7. Shell Programming and Scripting

Splitting XML file on basis of line number into multiple file

Hi All, I have more than half million lines of XML file , wanted to split in four files in a such a way that top 7 lines should be present in each file on top and bottom line of should be present in each file at bottom. from the 8th line actual record starts and each record contains 15 lines... (14 Replies)
Discussion started by: ajju
14 Replies

8. Shell Programming and Scripting

Execution of loop :Splitting a single file into multiple .dat file

hdr=$(cut -c1 $path$file|head -1)#extract header”H” trl=$(cut -c|path$file|tail -1)#extract trailer “T” SplitFile=$(cut -c 50-250 $path 1$newfile |sed'$/ *$//' head -1')# to trim white space and extract table name If; then # start loop if it is a header While read I #read file Do... (4 Replies)
Discussion started by: SwagatikaP1
4 Replies

9. Shell Programming and Scripting

Splitting a text file into smaller files with awk, how to create a different name for each new file

Hello, I have some large text files that look like, putrescine Mrv1583 01041713302D 6 5 0 0 0 0 999 V2000 2.0928 -0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 5.6650 0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 3.5217 ... (3 Replies)
Discussion started by: LMHmedchem
3 Replies

10. UNIX for Beginners Questions & Answers

Splitting the file based on two fields - Fixed length file

Hi , I am having a scenario where I need to split the file based on two field values. The file is a fixed length file. ex: AA0998703000000000000190510095350019500010005101980301 K 0998703000000000000190510095351019500020005101480 ... (4 Replies)
Discussion started by: saj
4 Replies
edge(8) 							SUPERUSER COMMANDS							   edge(8)

NAME
edge - n2n edge node daemon SYNOPSIS
edge [-d <tun device>] -a <tun IP address> -c <community> -k <encrypt key> -l <supernode host:port> [-p <local port>] [-u <UID>] [-g <GID>] [-f] [-m <MAC address>] [-t] [-r] [-v] DESCRIPTION
N2N is a peer-to-peer VPN system. Edge is the edge node daemon for n2n which creates a TAP interface to expose the n2n virtual LAN. On startup n2n creates the TAP interface and configures it then registers with the supernode so it can begin to find other nodes in the commu- nity. OPTIONS
-d <name> sets the TAP device name as seen in ifconfig. -a <addr> sets the n2n virtual LAN IP address being claimed. This is a private IP address. All IP addresses in an n2n community should belong to the same /24 network (ie. only the last segment of the IP addresses varies). -b cause edge to perform hostname resolution for the supernode address each time the supernode is periodically contacted. -c <community> sets the n2n community name. All edges within the same community look to be on the same LAN (layer 2 network segment). All edges communicating must use the same key and community name. -h write usage to tty then exit. -k <keystring> sets the twofish encryption key from ASCII text (see also N2N_KEY in ENVIRONMENT). All edges communicating must use the same key and community name. -l <addr>:<port> sets the n2n supernode IP address and port to register to. -p <num> binds edge to the given UDP port. Useful for keeping the same external socket across restarts of edge. -u <uid> causes the edge process to drop to the given user ID when privileges are no longer required. -g <gid> causes the edge process to drop to the given group ID when privileges are no longer required. -f causes the edge process to fork and run as a daemon, closing stdin, stdout, stderr and becoming a process group leader. -m <MAC> start the TAP interface with the given MAC address. This is highly recommended as it means the same address will be used if edge stops and restarts. If this is not done, the ARP caches of all peers will be wrong and packets will not flow to this edge until the next ARP refresh. -M <MTU> set the MTU of the edge interface in bytes. MTU is the largest packet fragment size allowed to be moved throught the interface. The default is 1400. -s <netmask> set the netmask of edge interface in IPv4 dotted decimal notation. The default is 255.255.255.0 (ie. /24). -t use HTTP tunneling instead of the normal UDP mechanism (experimental). -r enable packet forwarding/routing through the n2n virtual LAN. Without this option, packets arriving over n2n which are not for the -a <addr> IP address are dropped. -v use verbose logging. ENVIRONMENT
N2N_KEY set the encryption key so it is not visible on the command line EXAMPLES
edge -d n2n0 -c mynetwork -k encryptme -u 99 -g 99 -m DE:AD:BE:EF:01:23 -a 192.168.254.7 -p 50001 -l 123.121.120.119:7654 Start edge with TAP device n2n0 on community "mynetwork" with community supernode at 123.121.120.119 UDP port 7654 and bind the locally used UDP port to 50001. Use "encryptme" as the shared encryption key. Assign MAC address DE:AD:BE:EF:01:23 to the n2n inter- face and drop to user=99 and group=99 after the TAP device is successfull configured. Add the -f option to make edge run as a daemon. Somewhere else setup another edge with similar parameters, eg. edge -d n2n0 -c mynetwork -k encryptme -u 99 -g 99 -m DE:AD:BE:EF:01:21 -a 192.168.254.5 -p 50001 -l 123.121.120.119:7654 Now you can ping from 192.168.254.5 to 192.168.254.7. The MAC address (-m <MAC>) and virtual IP address (-a <addr>) must be different on all edges in the same community. CONFIGURATION
All configuration for edge is from the command line and environment variables. If you wish to reconfigure edge you should kill the process and restart with the desired options. EXIT STATUS
edge is a daemon and any exit is an error. AUTHOR
Luca Deri ( deri (at) ntop.org ), Richard Andrews ( andrews (at) ntop.org ), Don Bindner SEE ALSO
ifconfig(8) supernode(1) tunctl(8) revision 3679 Jan 3, 2009 edge(8)
All times are GMT -4. The time now is 09:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy