You are not logged in.

#1 2005-11-08 11:30:06

CyberTron
Member
From: Gotland ,Sweden
Registered: 2005-03-17
Posts: 645
Website

Sed help

Hi

I am trying to get rid of " " in a txt file with sed

although can't get it to work...(i am not very experinced with sed)

anyway, I have a txt file whic looks like this:

"hi" "there" "we" "like" "sed
and I wanna separate everythng so that i can get an output like
hi

there

and so on...

anyone who knows sed that can help me?


http://www.linuxportalen.com  -> Linux Help portal for Linux and ArchLinux (in swedish)

Dell Inspiron 8500
Kernel 2.6.14-archck1  (selfcompiled)
Enlightenment 17

Offline

#2 2005-11-08 11:32:31

CyberTron
Member
From: Gotland ,Sweden
Registered: 2005-03-17
Posts: 645
Website

Re: Sed help

solved it yself...there were some other errors fooling me

test=`sed 's|"||g' /tmp/.pkglist | awk '{ print $1 }'`


http://www.linuxportalen.com  -> Linux Help portal for Linux and ArchLinux (in swedish)

Dell Inspiron 8500
Kernel 2.6.14-archck1  (selfcompiled)
Enlightenment 17

Offline

#3 2005-11-08 11:35:39

Pajaro
Member
Registered: 2004-04-21
Posts: 884

Re: Sed help

echo "hola" "adios"|sed 's/" *"/n/'

Offline

#4 2005-11-08 12:40:40

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: Sed help

or

echo '"i" "like" "sed" "more"' | sed "s#"##g" | sed "s# #n#g"
i
like
sed
more

:-)

Offline

#5 2005-11-08 12:47:02

Pajaro
Member
Registered: 2004-04-21
Posts: 884

Re: Sed help

what if "i like" "sed more"? tongue mine was incomplete, just a show of how to use it

Offline

#6 2005-11-08 12:56:43

lanrat
Member
From: Poland
Registered: 2003-10-28
Posts: 1,274

Re: Sed help

We can do this all day... :-D

Offline

#7 2005-11-08 14:44:35

CyberTron
Member
From: Gotland ,Sweden
Registered: 2005-03-17
Posts: 645
Website

Re: Sed help

thanks guys big_smile

I have solved that part now...now there are some other problems, but hey, I will take that later :


http://www.linuxportalen.com  -> Linux Help portal for Linux and ArchLinux (in swedish)

Dell Inspiron 8500
Kernel 2.6.14-archck1  (selfcompiled)
Enlightenment 17

Offline

#8 2005-11-08 15:21:21

CyberTron
Member
From: Gotland ,Sweden
Registered: 2005-03-17
Posts: 645
Website

Re: Sed help

ok, so I have some more problems, not sure wheter they are related to my sed or not
   
*snippet*

test="/home/cybertron/gui/cat.list"
    LIST=`cat $test`

#    for app in `cat $PKGS | sed 's|/.*$||g' | uniq` ; do
for app in `sed 's/"//g' $PKGS`; do
        CHKLIST="$CHKLIST $app $LIST ON"
    done

*/end of snippet*
I have two files, pkg.list  and cat.list

what I want is to have my dialog --checklist to show things like this:

[x] program  description

whereas program is my pkg.list  and description is cat.list

hopefully you understand what I am trying to do?!!


http://www.linuxportalen.com  -> Linux Help portal for Linux and ArchLinux (in swedish)

Dell Inspiron 8500
Kernel 2.6.14-archck1  (selfcompiled)
Enlightenment 17

Offline

#9 2005-11-09 00:07:37

alterkacker
Member
From: Peoples Republic of Boulder
Registered: 2005-01-08
Posts: 52

Re: Sed help

Not entirely sure I understand this but I think you're looking for the 'paste' command which writes corresponding lines of multiple files to one output line. For example:

> cat -n f1
     1  f1l1
     2  f1l2
     3  f1l3
> cat -n f2
     1  f2l1
     2  f2l2
     3  f2l3
> paste -d' ' f1 f2 | cat -n
     1  f1l1 f2l1
     2  f1l2 f2l2
     3  f1l3 f2l3

Hope that helps!

Offline

#10 2005-11-09 00:20:58

CyberTron
Member
From: Gotland ,Sweden
Registered: 2005-03-17
Posts: 645
Website

Re: Sed help

that sounds like something I can use big_smile
I will most certainly try it

thanks !


Update: Doesn't quite do what I want,

I insert my whole code in here:

# INSTEAD OF SHOWING "INSTALL" in the dialog --checklist i wannt it to have a description, how this is done, I don't know...maybe someone does?!

select_install()
{
    dodialog msgbox "In the next stage you are going to choose which packages to install, recommendation is that you install all packages." 18 70
    CHKLIST=
    if [ "$MODE" = "install" ]; then
        PKGS=$PKGS_PATH
    fi
# INSTEAD OF SHOWING "INSTALL" in the dialog --checklist i wannt it to have a description, how this is done, I don't know...maybe someone does?!

    for app in `sed 's|"||g' $PKGS | awk '{ print $1 }'`; do
        CHKLIST="$CHKLIST $app INSTALL ON"
    done
    
    if [ -e /tmp/.pkglist ]; then 
    rm /tmp/.pkglist
    fi

    domenu checklist "Select Packages" 19 55 12 $CHKLIST 2>/tmp/.pkglist || return 1
        
    if [ $? == 0 ]; then
    install
    else
    mainmenu
    fi
}

http://www.linuxportalen.com  -> Linux Help portal for Linux and ArchLinux (in swedish)

Dell Inspiron 8500
Kernel 2.6.14-archck1  (selfcompiled)
Enlightenment 17

Offline

Board footer

Powered by FluxBB