howto change format of file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting howto change format of file?
# 1  
Old 07-14-2010
howto change format of file?

Hi
I have a file with this inside:

Quote:
default:
roles =

esaadmin:
roles = SysConfig

israel1:
roles = so

israel:
roles = admincsia
How can I change it to:

Quote:
default roles =
esaadmin: roles =
israel1: roles =
israel: roles =
thanks a lot
regards
Israel.
# 2  
Old 07-14-2010
Code:
awk ' $0~/:$/ {printf ("%s ", $0); next} 
        {print $0}   ' inputfile > outputfile

# 3  
Old 07-14-2010
Nice!!

thanks
# 4  
Old 07-15-2010
Code:
awk 'BEGIN{RS=""}{print $1,$2,$3}' urfile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Change date format in a file.

Hi all, I have a file as below, i would like the change the format of the time from "11/7/2019 20:12" to "2019-07-11 20:12:00" in the last coloumn. any awk solution on this. Input: 2,0,695016,1961612,497212,5800804,0,0,161,33,7605,12226,23,10,66,0,0,34,11/7/2019 20:10... (4 Replies)
Discussion started by: Raghuram717
4 Replies

2. Shell Programming and Scripting

Change the file format

gpio_rw = gpiochip162 audio_aplay = HDMI_0 audio_aplay = HDMI_1 audio_aplay = HDMI_2 graphic_xrandr_show = USB1 graphic_xrandr_show = USB2 graphic_xrandr_show = USB3 graphic_change_resolution = eDP1 gpio_rw = "gpiochip162" audio_aplay = "HDMI_0 HDMI_1 HDMI_2" graphic_xrandr_show =... (3 Replies)
Discussion started by: yanglei_fage
3 Replies

3. Shell Programming and Scripting

File date format how to change

Hi All, Below are the unix files taken by the help of ls -lrt -rw-r--r-- 1 kbehera Domain Users 293 Jul 27 13:33 sand.txt -rw-r--r-- 1 kbehera Domain Users 4 Jul 27 13:37 sand1.txt -rw-r--r-- 1 kbehera Domain Users 293 Jul 27 15:30 new_sand.txt -rw-r--r-- 1 kbehera Domain Users 0 Jul 27... (2 Replies)
Discussion started by: krupasindhu18
2 Replies

4. Shell Programming and Scripting

HOWTO - change letter case of variable value

Hi I have e.g. VAR1=january and I need to change it into VAR1=January. How to change value of VAR1 variable to always set first character uppercase and other lowercase ? thx for help. (9 Replies)
Discussion started by: presul
9 Replies

5. HP-UX

[Solved] Howto change subdirectory easily using cd

Hi all, how to change the path easily from /u01/oracle/oradata/newdb/tab >cd olddb /u01/oracle/oradata/olddb/tab > or /u01/oracle/oradata/newdb/tab >cd u05 /u05/oracle/oradata/newdb/tab > I am lazy for typing the abs. path again... As I know there is some "tips" in doing this. ... (2 Replies)
Discussion started by: freddy1228
2 Replies

6. Shell Programming and Scripting

Change file output format

I have a file which has following contents usmtnz-dinfsi19 62 61 18400 18800 99.7 usmtnz-dinfsi19 62 61 18400 18800 99.7 i want the o/p to be like date (7 Replies)
Discussion started by: fugitive
7 Replies

7. Shell Programming and Scripting

To Change the file format Pls Help!!!

Hi All, I have a file like john::208:johnson john::208:mery john::208:test admin:*:1:johnson admin:*:1:test and wanna convert this as john::208:johnson,mery,test admin:*:1:johnson,test please help me to create a script for this thanks in advance John (4 Replies)
Discussion started by: johnsonpk
4 Replies

8. Shell Programming and Scripting

Change file format

Hi I have a file in the following format I have to convert this into four files , in the format as below. Data under Process SFA SUccess Section gets into file Named SFA_SUCCESS inthe following format ctr1,120 ctr2,1785 Data under Process SFA FAil gets into file Named SFA_Fail inthe... (2 Replies)
Discussion started by: sapics
2 Replies

9. UNIX for Dummies Questions & Answers

howto change parameter in vi to take tmp file

i have a problem running vi. there is no space in /var where it creates tmp file. How can I change this parameter so that it takes from other directory. thanks (4 Replies)
Discussion started by: ajaya
4 Replies

10. UNIX for Advanced & Expert Users

Change format to file II

hi all... i have a big problem, and i hope someone can help me... i have a flat file, and its columns are separated by comma (CSV), something like this: 78 , 204R180 , 90/100 , 200001 , 12 ,200002 ,13 ..... 78 , 204R180 , 90/100 , 200001 , 29 ,200002 ,30 ..... 78 , 204R180 , 90/100 ,... (0 Replies)
Discussion started by: DebianJ
0 Replies
Login or Register to Ask a Question