I have recently join the forum and this is my first post....hoping to get a suggestion to a problem that I am facing.
I have a script that works well on ksh unix on AIX server. The below mentioned code checks number of records in an input file starting with 99 and splits it accordingly and creates new files. i.e. if there are two records starting with 99 then two new files are created.
Format of data in the input file: 10ABC 20150624
99ABC 20150624
10DEF 20150624
99DEF 20150624
In case if there is a single 99 record in the input file, the value of REPEAT is set to -1. In AIX the code works and it looks like
Now, I am trying to run the same script in Linux, but the above "csplit" code is not working.
The "-1" value of repeat is not recognised in linux. I guess it only recognises postive integers where pattern repeatation is mentioned.
To fix this, I tried hardcoding positive value like 1...it worked but created two files instead and out of the two, one is 0 byte file. It seems that the above csplit code line needs modification in order to run it in Linux.
Could you please suggest any alternative to make this part of the code work in linux.
Details of Linux version is: Red Hat Linux release 6.6 (Santiago)
shell: ksh
Input file:
CLK00027 TESTDATA 0 S 600000 \r
0001RFC 192321 321321 321321 \r
0002 rfd this is testdata1
CLK00027 TESTDATA 0 S 600000 \r
0001RFC 192321 321321 321321 \r
0002 rfd this is testdata2
I Need to split this file into seperate files
file1.txt
CLK00027 ... (1 Reply)
Hello
am trying to split the following top output at the TTY line but having some issues:
System: msisprd Sun Oct 9 09:35:37 2011
Load averages: 0.14, 0.17, 0.16
411 processes: 361 sleeping, 50 running
Cpu states:
CPU LOAD USER NICE SYS ... (3 Replies)
Hi,
My question is that is there any substitute command for mail in ubuntu because I'm trying to run it and it is showing error: command not found!!
Will it need to download any specific package? If so please tell me how can I download that pkg.
Thanks in advance. (1 Reply)
I want to split big files based on a pattern to stdout.
Although csplit works well for me splitting the output into separate files (e.g. xx00, xx01, xx02, ...), the following is not working as expected:
<code>
# assuming pattern occurs less than 100 times
csplit bigfile '%pattern%'... (2 Replies)
when I try to apply this principle to my script, is not working, it tells me something like 'command not found'
what i wrote is this..
if ;
then echo "message1";
else echo "message2"; fi
I'm supposed to count number of processes of the user, and if they're five or more, then a message... (2 Replies)
Hello all
The below command works perfeft when executed from the shell prompt.
"csplit -f first Allocation.log.1 "%. Oct 02 .%" {1} "
and generates first00 file.
But it fails if I include the same command in my script.
I am trying to automate some process and this is turning... (1 Reply)
When trying to find a list of files with specific text in them using
find . -type f -exec grep -l "DataStage Job 4263" {}\;
I get error
find: missing argument to 'exec'
How can I correct this ? I'm on Linux Red Hat.
Cheers
PS I'm a DataStage programmer not a systems support... (4 Replies)
Hi All,
I have a strange behaviour from csplit command on some text files.
I have a comma separated file and data with in double quotes. This file is being generated from Sequential stage of Data stage tool.
This file has 67 fields in each records with some null and blank in the data.... (4 Replies)
Dear Friends,
please help me.
I am using csplit to split the files,
i.e.,
csplit -f filetype_ -n 3 filename '/regexpn/' {5}
which will split file "filename" into 5 subfiles
filetype_000
filetype_001
filetype_002
filetype_003
filetype_004
but if I run the csplit commad again it will... (2 Replies)