Search Results

Search: Posts Made By: sameermohite
2,461
Posted By Akshay Hegde
OR $ echo '0001 firstname1 lastname1 0002...
OR

$ echo '0001 firstname1 lastname1 0002 firstname2 lastname2 0003 firstname3 lastname3 0004 firstname4 lastname4' | xargs -n 3
0001 firstname1 lastname1
0002 firstname2 lastname2
0003...
2,461
Posted By RudiC
Try alsotr ' ' '\n' <file | paste -s -d' \n' ...
Try alsotr ' ' '\n' <file | paste -s -d' \n'
0001 firstname1 lastname1
0002 firstname2 lastname2
0003 firstname3 lastname3
0004 firstname4 lastname4 Be aware that not all systems accept the \n...
2,461
Posted By Akshay Hegde
$ cat file 0001 firstname1 lastname1 0002...
$ cat file
0001 firstname1 lastname1 0002 firstname2 lastname2 0003 firstname3 lastname3 0004 firstname4 lastname4

$ awk 'ORS = !(NR%3)? "\n" : FS ' RS=" " file
0001 firstname1 lastname1
0002...
1,303
Posted By Akshay Hegde
Try : #!/bin/bash for i in server1...
Try :

#!/bin/bash

for i in server1 server2
do
eval ${i}_name="apache"
eval echo \$${i}_name
done

$ bash tester
apache
apache
7,727
Posted By Don Cragun
To get the other fields (and print the values...
To get the other fields (and print the values from each input line on a single output line) try:
awk -F '[()]' '
{ for(i = 2; i < NF; i += 2)
printf("%s%s", $i, i == NF - 1 ?...
7,727
Posted By krishmaths
awk solution (can be made better) awk...
awk solution (can be made better)


awk '{for(i=1;i<=NF;i++) {if($i~/\(/) a=a" "substr($i,1+index($i,"("))} }{gsub(/\)/,"",a);print a;a=""}' infile
7,727
Posted By Skrynesaver
$ echo 'mike(hussey) AND mike(donald) AND...
$ echo 'mike(hussey) AND mike(donald) AND mike(ryan) AND mike(johnson)' | perl -ne '@surnames=$_=~/\(([^)]+)\)/g;print join"\n",@surnames' -
hussey
donald
ryan
johnson
Showing results 1 to 7 of 7

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