Search Results

Search: Posts Made By: wenclu
3,528
Posted By hergp
On Linux, you can write script -c...
On Linux, you can write

script -c myscript.sh -f out

The script command will run myscript.sh and write the output to the screen and to out. The -f option makes script flush the buffer after...
3,730
Posted By Corona688
What's your system? What's your shell? In BASH,...
What's your system? What's your shell? In BASH, you can use read -e to read lines using readline mode, which lets you edit with left-right keys, but that still doesn't support multiple lines. If...
3,730
Posted By RudiC
Again, what's your purpose? Do you want to skip...
Again, what's your purpose? Do you want to skip back in your input lines or do you just want to move left and right? The latter can be achieved - in bash, may be unavailable in other shells - by...
3,730
Posted By rangarasan
bash
Hi,

Try this one,


readmultiline.sh

#! /usr/bin/env bash
file=file1
while read LINE; do
if [ -z "$LINE" ]; then
break
fi
echo -e "${LINE}" >>$file
done

$ bash readmultiline.sh...
3,730
Posted By RudiC
What do you mean? Do you want to skip through...
What do you mean? Do you want to skip through earlier input lines with the arrow keys?
3,730
Posted By pamu
try this.. while [[ $a < 2 ]] do read...
try this..

while [[ $a < 2 ]]
do
read line
if [[ "$line" != "" ]]
then
let a=0
echo $line >> file_temp
else
let a++;
fi
doneIt will stop if user press two consecutive enters..(Means two...
1,245
Posted By bakunin
Have a look at the man page of "fmt". "fmt -50"...
Have a look at the man page of "fmt". "fmt -50" is probably what you want.

I hope this helps.

bakunin
1,245
Posted By elixir_sinari
fold -sw50 file
fold -sw50 file
1,187
Posted By elixir_sinari
startpatt='Value B' occur='Status:' awk 's &&...
startpatt='Value B'
occur='Status:'
awk 's && $0~occ{$0=occ " PASSED";s=0}$0~sp{s=1}1' sp="$startpatt" occ="$occur" file
1,187
Posted By bmk
Can you try like.. sed '0,/Status: -/s//Status:...
Can you try like..
sed '0,/Status: -/s//Status: PASSED/' test.txt
1,187
Posted By elixir_sinari
awk 's && /Status:/{$0="Status:...
awk 's && /Status:/{$0="Status: PASSED";s=0}/Value B/{s=1}1' file
1,200
Posted By pamu
Try this... var=9 awk -v VM="$var" '{if...
Try this...


var=9
awk -v VM="$var" '{if (NR==1 || v != $3) {v=$3; print "Value " v;$3="";{for(i=1;i<=VM;i++) {printf "-"}{print " ----"}}} else{$3=""}}1' file
1,200
Posted By Franklin52
Try this: awk 'NR==1 || v != $3 {v=$3; print...
Try this:
awk 'NR==1 || v != $3 {v=$3; print "Value " v}1' $file > $tmp
3,117
Posted By rangarasan
awk
Hi,

Try this out,


awk '/^111$/ && !p{p=1;print $0 FS "555" RS "000";next;}1' file


Cheers,
Ranga :)
3,117
Posted By Ygor
Try...$ head file[12] ==> file1 <== 999 111...
Try...$ head file[12]
==> file1 <==
999
111
222
333
111
444

==> file2 <==
555
000

$ awk '/111/&&!c++{$0=$0 s};1' s="$(<file2)" file1
999
111 555
000
222
333
111
3,117
Posted By pamu
Try something like this.. awk '{if(s ==...
Try something like this..


awk '{if(s == "") {if($0 == "111") { s=$0 FS 555; print s;print "000"} else {print}} else{ print}}' file
3,117
Posted By pamu
Just remove FS from above code.. Try this.. ...
Just remove FS from above code..

Try this..


awk '{if(s == "") {if($0 == "111") { s=$0 555; print s;print "000"} else {print}} else{ print}}' file
3,094
Posted By delugeag
sed -n -r '/Name =A/,/Value =/{/Value = (.*)/...
sed -n -r '/Name =A/,/Value =/{/Value = (.*)/ s//\1/p}' $file
3,094
Posted By msabhi
awk 'BEGIN{RS="Name";}...
awk 'BEGIN{RS="Name";} {for(i=1;i<=NF;i++){if($i=="Value"){i+=2;print $i;break;}}}' input_file
3,094
Posted By vgersh99
sorryy, fat fingers...
sorryy, fat fingers...
Showing results 1 to 20 of 20

 
All times are GMT -4. The time now is 05:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy