I'm new to perl, I have input file that contains the string below:
This string has as line separator "ff45". So, I want to print each line but the code below is not working.
If the only condition is set as line separator "ff45", the output would be:
But when the line length is less than 7 I want to concatenate that small line with the next one,
So, the final output I'd like to get is below (red part is small line, in blue next line):
May you help me in how to get this.
PS: If possible, I'd like only to modify the code inside the while loop, since I want to incorporate as part of a bigger script.
I am looking for help in processing of those options: '-n' or '-p'
I understand what they do and how to use them.
But, I would like to use them with more than one file (and without any shell-loop; loading the 'perl' once.)
I did try it and -n works on 2 files.
Question is:
- is it possible to... (6 Replies)
Hi,
Do anybody experience how to concatenate multiple line into one line by using awk or perl command?
Input file:
>set1
QAWEQRQ@EWQEASED
ASDAEQW
QAWEQRQTQ
ASRFQWRGWQ
From the above Input file, it got 5 lines
Desired output file:
>set1... (6 Replies)
I have several hundreds of tiny files which need to be concatenated into one single line and all those in a single file. Some files have several blank lines. Tried to use this script but failed on it.
awk 'END { print r } r && !/^/ { print FILENAME, r; r = "" }{ r = r ? r $0 : $0 }' *.txt... (8 Replies)
Unix box server version
***********
>uname -r
B.11.00
>echo $SHELL
/usr/bin/ksh
--> in this server, I have the path like /IMbuild/dev/im0serv1
---> in that directory I have the folders startup(.jsp files nearly 100 jsp's ) and scripts(contains .js files nearly 100 files) ... (9 Replies)
so in unix this command works works and shows me a list of directories
find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt
but when i try running a perl script to run this command
my $query = 'find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt';... (2 Replies)
Hi:
I use the snmpget command everyday. And Im getting tire of writing the same line evertime I have to verify something.
Example of the line:
snmpget -c DreamTeam dal2-hr2 ifAlias.227
The .227 its the circuit interface and also its variable; could be any other number depending on the... (13 Replies)
Can anyone help me get this small sed script to work in shell on the command line?
I need it in a one liner really as i want to edit many scripts in a for loop and dont want to have to invoke a separate script each time.
#!/bin/sh
sed '/mailx\ -s.*$ {
i\
#Comment above mailx line ... (5 Replies)
Hi
I have a log file (say log.txt). I have to search for a line which has the string ( say ERROR) in the log file and copy 15 lines after this into another file (say error.txt). Can someone give me the code and this has to be in PERL
Thanks in advance
Ammu (3 Replies)
Hi, I have a noob question . Can someone help me how to concatenate line by line using this variables?
var1:
Apple|
Banana|
var2:
Red
Yellow
then how can I concatenate both line by line? in which the result would be:
Apple|Red
Banana|Yellow
just to generate a row result i was... (6 Replies)
Hi All,
i have a zip file like the format
794051400123|COM|24|0|BD|R|99.98
794051413727|COM|11|0|BD|R|28.99
794051415622|COM|23|0|BD|R|28.99
883929004676|COM|0|0|BD|R|28.99
794051400123|MOM|62|0|BD|R|99.98
794051413727|MOM|4|0|BD|R|28.99
794051415622|MOM|80|0|BD|R|28.99
... (30 Replies)